From: Neil Brown Date: Tue, 8 May 2007 04:43:28 +0000 (+1000) Subject: Remove rquotad X-Git-Tag: nfs-utils-1-1-0~3 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=commitdiff_plain;h=71ad2bbcae08d0cfb32d733dc30c0826d2e5eee4;hp=a5f020dda1a93657eae1b297a67d054269a3ef0c Remove rquotad rquotad isn't really used by anyone - as you can tell by the fact that it only works for ext2 and ext3 (if those). The 'quota' package contains a working and maintained rquota and all distros appear to use that one. So remove rquotad from this package to avoid confusion. --- diff --git a/configure.ac b/configure.ac index 2c905a5..0e64716 100644 --- a/configure.ac +++ b/configure.ac @@ -104,17 +104,6 @@ AC_ARG_ENABLE(secure-statd, AC_DEFINE(RESTRICTED_STATD, 1, [Define this if you want to enable various security checks in statd. These checks basically keep anyone but lockd from using this service.]) fi AC_SUBST(secure_statd) -AC_ARG_ENABLE(rquotad, - [AC_HELP_STRING([--enable-rquotad], - [enable rquotad @<:@default=yes@:>@])], - enable_rquotad=$enableval, - enable_rquotad=yes) - if test "$enable_rquotad" = yes; then - RQUOTAD=rquotad - else - RQUOTAD= - fi - AM_CONDITIONAL(CONFIG_RQUOTAD, [test "$enable_rquotad" = "yes"]) AC_ARG_WITH(rpcgen, [AC_HELP_STRING([--with-rpcgen=internal], [use internal rpcgen instead of system one])], rpcgen_path=$withval, @@ -377,7 +366,6 @@ AC_CONFIG_FILES([ utils/mountd/Makefile utils/nfsd/Makefile utils/nfsstat/Makefile - utils/rquotad/Makefile utils/showmount/Makefile utils/statd/Makefile]) AC_OUTPUT diff --git a/utils/Makefile.am b/utils/Makefile.am index c1bc059..8665183 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -2,10 +2,6 @@ OPTDIRS = -if CONFIG_RQUOTAD -OPTDIRS += rquotad -endif - if CONFIG_NFSV4 OPTDIRS += idmapd endif diff --git a/utils/rquotad/Makefile.am b/utils/rquotad/Makefile.am deleted file mode 100644 index 4bc036f..0000000 --- a/utils/rquotad/Makefile.am +++ /dev/null @@ -1,87 +0,0 @@ -## Process this file with automake to produce Makefile.in - - -GENFILES_XDR = rquota_xdr.c -GENFILES_H = rquota.h - -BUILT_SOURCES = $(GENFILES_H) - -GENFILES = $(GENFILES_XDR) $(GENFILES_H) -man8_MANS = rquotad.man - -RPCPREFIX = rpc. -KPREFIX = @kprefix@ -sbin_PROGRAMS = rquotad - -EXTRA_DIST = rquota.x $(man8_MANS) NEW README.okir - -rquotad_SOURCES = rquota_server.c rquota_svc.c rquota_xdr.c quotactl.c \ - hasquota.c mntent.h rquota.h -rquotad_LDADD = ../../support/export/libexport.a \ - ../../support/nfs/libnfs.a \ - ../../support/misc/libmisc.a \ - $(LIBBSD) $(LIBWRAP) $(LIBNSL) -rquotad_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) \ - -I$(top_srcdir)/support/export - -MAINTAINERCLEANFILES = Makefile.in - -if CONFIG_RPCGEN -RPCGEN = $(top_builddir)/tools/rpcgen/rpcgen -$(RPCGEN): - make -C $(top_srcdir)/tools/rpcgen all -else -RPCGEN = @RPCGEN_PATH@ -endif - -$(GENFILES_XDR): %_xdr.c: %.x $(RPCGEN) - test -f $@ && rm -rf $@ || true - $(RPCGEN) -c -o $@ $< - - -$(GENFILES_H): %.h: %.x $(RPCGEN) - test -f $@ && rm -rf $@ || true - $(RPCGEN) -h -o $@ $< - -CLEANFILES = $(GENFILES) - -####################################################################### -# The following allows the current practice of having -# daemons renamed during the install to include RPCPREFIX -# and the KPREFIX -# This could all be done much easier with program_transform_name -# ( program_transform_name = s/^/$(RPCPREFIX)$(KPREFIX)/ ) -# but that also renames the man pages, which the current -# practice does not do. -install-exec-hook: - (cd $(DESTDIR)$(sbindir) && \ - for p in $(sbin_PROGRAMS); do \ - mv -f $$p$(EXEEXT) $(RPCPREFIX)$(KPREFIX)$$p$(EXEEXT) ;\ - done) -uninstall-hook: - (cd $(DESTDIR)$(sbindir) && \ - for p in $(sbin_PROGRAMS); do \ - rm -f $(RPCPREFIX)$(KPREFIX)$$p$(EXEEXT) ;\ - done) - - -# XXX This makes some assumptions about what automake does. -# XXX But there is no install-man-hook or install-man-local. -install-man: install-man8 install-man-links -uninstall-man: uninstall-man8 uninstall-man-links - -install-man-links: - (cd $(DESTDIR)$(man8dir) && \ - for m in $(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS); do \ - inst=`echo $$m | sed -e 's/man$$/8/'`; \ - rm -f $(RPCPREFIX)$$inst ; \ - $(LN_S) $$inst $(RPCPREFIX)$$inst ; \ - done) - -uninstall-man-links: - (cd $(DESTDIR)$(man8dir) && \ - for m in $(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS); do \ - inst=`echo $$m | sed -e 's/man$$/8/'`; \ - rm -f $(RPCPREFIX)$$inst ; \ - done) - diff --git a/utils/rquotad/NEW b/utils/rquotad/NEW deleted file mode 100644 index 40c6fd2..0000000 --- a/utils/rquotad/NEW +++ /dev/null @@ -1,3 +0,0 @@ -This is Marco van Wieringen's rpc.rquotad in quotas-1.70 from - -ftp://ftp.cistron.nl/pub/people/mvw/quota diff --git a/utils/rquotad/README.okir b/utils/rquotad/README.okir deleted file mode 100644 index 08938b9..0000000 --- a/utils/rquotad/README.okir +++ /dev/null @@ -1,3 +0,0 @@ - -This is Marco van Wieringen's rpc.rquotad from quotas-1.55. - diff --git a/utils/rquotad/hasquota.c b/utils/rquotad/hasquota.c deleted file mode 100644 index d2d8115..0000000 --- a/utils/rquotad/hasquota.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * QUOTA An implementation of the diskquota system for the LINUX - * operating system. QUOTA is implemented using the BSD systemcall - * interface as the means of communication with the user level. - * Should work for all filesystems because of integration into the - * VFS layer of the operating system. - * This is based on the Melbourne quota system wich uses both user and - * group quota files. - * - * Determines if a filesystem has quota enabled and how the quotafile - * is named. - * - * Version: $Id: hasquota.c,v 2.6 1996/11/17 16:59:46 mvw Exp mvw $ - * - * Author: Marco van Wieringen - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#define _LINUX_QUOTA_VERSION 1 - -#include -#include -#include -#include -#include "mntent.h" -#include "xmalloc.h" - -#undef min -#define min(x,y) ((x) < (y)) ? (x) : (y) - -#define CORRECT_FSTYPE(type) \ -((!strcmp(type,MNTTYPE_EXT2)) || (!strcmp(type,MNTTYPE_EXT3))) - -char *qfextension[] = INITQFNAMES; - -/* - * Check to see if a particular quota is to be enabled. - */ -int -hasquota(struct mntent *mnt, int type, char **qfnamep) -{ - char *qfname = QUOTAFILENAME; - char *option, *pathname; - - if (!CORRECT_FSTYPE(mnt->mnt_type)) - return (0); - - if (((type == USRQUOTA) && (option = hasmntopt(mnt, MNTOPT_USRQUOTA)) != (char *)0) || - ((type == GRPQUOTA) && (option = hasmntopt(mnt, MNTOPT_GRPQUOTA)) != (char *)0)) { - if ((pathname = strchr(option, '=')) == (char *)0) { - *qfnamep=xmalloc(strlen(mnt->mnt_dir)+strlen(qfname)+strlen(qfextension[type])+3); - (void) sprintf(*qfnamep, "%s%s%s.%s", mnt->mnt_dir, - (mnt->mnt_dir[strlen(mnt->mnt_dir) - 1] == '/') ? "" : "/", - qfname, qfextension[type]); - } else { - if ((option = strchr(++pathname, ',')) != (char *)NULL) { - int len=option-pathname; - *qfnamep=xmalloc(len); - memcpy(*qfnamep, pathname, len-1); - (*qfnamep) [len-1] = '\0'; - } - else { - *qfnamep=xstrdup(pathname); - } - } - return (1); - } else - return (0); -} diff --git a/utils/rquotad/mntent.h b/utils/rquotad/mntent.h deleted file mode 100644 index 34ded5f..0000000 --- a/utils/rquotad/mntent.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef _MNTENT_H -#define _MNTENT_H - -#include - -#define MNTTAB "/etc/fstab" -#define MOUNTED "/etc/mtab" - -#define MNTMAXSTR 512 - -#define MNTTYPE_COHERENT "coherent" /* Coherent file system */ -#define MNTTYPE_EXT "ext" /* Extended file system */ -#define MNTTYPE_EXT2 "ext2" /* Second Extended file system */ -#define MNTTYPE_EXT3 "ext3" /* Journaled Second Extended file system */ -#define MNTTYPE_HPFS "hpfs" /* OS/2's high performance file system */ -#define MNTTYPE_ISO9660 "iso9660" /* ISO CDROM file system */ -#define MNTTYPE_MINIX "minix" /* MINIX file system */ -#define MNTTYPE_MSDOS "msdos" /* MS-DOS file system */ -#define MNTTYPE_SYSV "sysv" /* System V file system */ -#define MNTTYPE_UMSDOS "umsdos" /* U MS-DOS file system */ -#define MNTTYPE_XENIX "xenix" /* Xenix file system */ -#define MNTTYPE_XIAFS "xiafs" /* Frank Xia's file system */ -#define MNTTYPE_NFS "nfs" /* Network file system */ -#define MNTTYPE_PROC "proc" /* Linux process file system */ -#define MNTTYPE_IGNORE "ignore" /* Ignore this entry */ -#define MNTTYPE_SWAP "swap" /* Swap device */ - -/* generic mount options */ -#define MNTOPT_DEFAULTS "defaults" /* use all default opts */ -#define MNTOPT_RO "ro" /* read only */ -#define MNTOPT_RW "rw" /* read/write */ -#define MNTOPT_SUID "suid" /* set uid allowed */ -#define MNTOPT_NOSUID "nosuid" /* no set uid allowed */ -#define MNTOPT_NOAUTO "noauto" /* don't auto mount */ - -/* ext2 and msdos options */ -#define MNTOPT_CHECK "check" /* filesystem check level */ - -/* ext2 specific options */ -#define MNTOPT_BSDDF "bsddf" /* disable MINIX compatibility disk free counting */ -#define MNTOPT_BSDGROUPS "bsdgroups" /* set BSD group usage */ -#define MNTOPT_ERRORS "errors" /* set behaviour on error */ -#define MNTOPT_GRPID "grpid" /* set BSD group usage */ -#define MNTOPT_MINIXDF "minixdf" /* enable MINIX compatibility disk free counting */ -#define MNTOPT_NOCHECK "nocheck" /* reset filesystem checks */ -#define MNTOPT_NOGRPID "nogrpid" /* set SYSV group usage */ -#define MNTOPT_RESGID "resgid" /* group to consider like root for reserved blocks */ -#define MNTOPT_RESUID "resuid" /* user to consider like root for reserved blocks */ -#define MNTOPT_SB "sb" /* set used super block */ -#define MNTOPT_SYSVGROUPS "sysvgroups" /* set SYSV group usage */ - -/* options common to hpfs, isofs, and msdos */ -#define MNTOPT_CONV "conv" /* convert specified types of data */ -#define MNTOPT_GID "gid" /* use given gid */ -#define MNTOPT_UID "uid" /* use given uid */ -#define MNTOPT_UMASK "umask" /* use given umask, not isofs */ - -/* hpfs specific options */ -#define MNTOPT_CASE "case" /* case conversation */ - -/* isofs specific options */ -#define MNTOPT_BLOCK "block" /* use given block size */ -#define MNTOPT_CRUFT "cruft" /* ??? */ -#define MNTOPT_MAP "map" /* ??? */ -#define MNTOPT_NOROCK "norock" /* not rockwell format ??? */ - -/* msdos specific options */ -#define MNTOPT_FAT "fat" /* set FAT size */ -#define MNTOPT_QUIET "quiet" /* ??? */ - -/* swap specific options */ - -/* options common to ext, ext2, minix, xiafs, sysv, xenix, coherent */ -#define MNTOPT_NOQUOTA "noquota" /* don't use any quota on this partition */ -#define MNTOPT_USRQUOTA "usrquota" /* use userquota on this partition */ -#define MNTOPT_GRPQUOTA "grpquota" /* use groupquota on this partition */ -#define MNTOPT_RSQUASH "rsquash" /* threat root as an ordinary user */ - -/* none defined yet */ - -__BEGIN_DECLS - -struct mntent{ - char *mnt_fsname; - char *mnt_dir; - char *mnt_type; - char *mnt_opts; - int mnt_freq; - int mnt_passno; -}; - -__END_DECLS - -#define __need_file -#include - -__BEGIN_DECLS - -extern FILE *setmntent __P ((__const char *__filep, - __const char *__type)); -extern struct mntent - *getmntent __P ((FILE *__filep)); -extern int addmntent __P ((FILE *__filep, - __const struct mntent *__mnt)); -extern char *hasmntopt __P ((__const struct mntent *__mnt, - __const char *__opt)); -extern int endmntent __P ((FILE *__filep)); - -extern int hasquota __P ((struct mntent *, int, char **)); - -__END_DECLS - -#endif /* _MNTENT_H */ diff --git a/utils/rquotad/quotactl.c b/utils/rquotad/quotactl.c deleted file mode 100644 index 8966335..0000000 --- a/utils/rquotad/quotactl.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * QUOTA An implementation of the diskquota system for the LINUX - * operating system. QUOTA is implemented using the BSD systemcall - * interface as the means of communication with the user level. - * Should work for all filesystems because of integration into the - * VFS layer of the operating system. - * This is based on the Melbourne quota system wich uses both user and - * group quota files. - * - * System call interface. - * - * Version: $Id: quotactl.c,v 2.3 1995/07/23 09:58:06 mvw Exp mvw $ - * - * Author: Marco van Wieringen - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -int quotactl(int cmd, const char * special, int id, caddr_t addr) -{ - return syscall(SYS_quotactl, cmd, special, id, addr); -} diff --git a/utils/rquotad/rquota.x b/utils/rquotad/rquota.x deleted file mode 100644 index 120abe5..0000000 --- a/utils/rquotad/rquota.x +++ /dev/null @@ -1,84 +0,0 @@ -/* @(#)rquota.x 2.1 88/08/01 4.0 RPCSRC */ -/* @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro */ - -/* - * Remote quota protocol - * Requires unix authentication - */ - -#ifdef RPC_CLNT -%#include -#endif - -const RQ_PATHLEN = 1024; - -struct getquota_args { - string gqa_pathp; /* path to filesystem of interest */ - int gqa_uid; /* Inquire about quota for uid */ -}; - -struct ext_getquota_args { - string gqa_pathp; /* path to filesystem of interest */ - int gqa_type; /* Type of quota info is needed about */ - int gqa_id; /* Inquire about quota for id */ -}; - -/* - * remote quota structure - */ -struct rquota { - int rq_bsize; /* block size for block counts */ - bool rq_active; /* indicates whether quota is active */ - unsigned int rq_bhardlimit; /* absolute limit on disk blks alloc */ - unsigned int rq_bsoftlimit; /* preferred limit on disk blks */ - unsigned int rq_curblocks; /* current block count */ - unsigned int rq_fhardlimit; /* absolute limit on allocated files */ - unsigned int rq_fsoftlimit; /* preferred file limit */ - unsigned int rq_curfiles; /* current # allocated files */ - unsigned int rq_btimeleft; /* time left for excessive disk use */ - unsigned int rq_ftimeleft; /* time left for excessive files */ -}; - -enum gqr_status { - Q_OK = 1, /* quota returned */ - Q_NOQUOTA = 2, /* noquota for uid */ - Q_EPERM = 3 /* no permission to access quota */ -}; - -union getquota_rslt switch (gqr_status status) { -case Q_OK: - rquota gqr_rquota; /* valid if status == Q_OK */ -case Q_NOQUOTA: - void; -case Q_EPERM: - void; -}; - -program RQUOTAPROG { - version RQUOTAVERS { - /* - * Get all quotas - */ - getquota_rslt - RQUOTAPROC_GETQUOTA(getquota_args) = 1; - - /* - * Get active quotas only - */ - getquota_rslt - RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2; - } = 1; - version EXT_RQUOTAVERS { - /* - * Get all quotas - */ - getquota_rslt - RQUOTAPROC_GETQUOTA(ext_getquota_args) = 1; - - /* - * Get active quotas only - */ - getquota_rslt - RQUOTAPROC_GETACTIVEQUOTA(ext_getquota_args) = 2; - } = 2; -} = 100011; diff --git a/utils/rquotad/rquota_server.c b/utils/rquotad/rquota_server.c deleted file mode 100644 index f8bd8f1..0000000 --- a/utils/rquotad/rquota_server.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * QUOTA An implementation of the diskquota system for the LINUX - * operating system. QUOTA is implemented using the BSD systemcall - * interface as the means of communication with the user level. - * Should work for all filesystems because of integration into the - * VFS layer of the operating system. - * This is based on the Melbourne quota system wich uses both user and - * group quota files. - * - * This part does the lookup of the info. - * - * Version: $Id: rquota_server.c,v 2.9 1996/11/17 16:59:46 mvw Exp mvw $ - * - * Author: Marco van Wieringen - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include "rquota.h" -#include -#include -#include -/* Unfortunately we cannot trust sys/quota.h to have - * what we need, either the old interface could be missing - * (SLES9) or the new (SLES8 and others). - * So we will just put it explicitly below - */ -#if 0 -#include -#endif -#include -#include -#include -#include -#include -#include -#include "mntent.h" -#include "xmalloc.h" - -#define TYPE_EXTENDED 0x01 -#define ACTIVE 0x02 - -#ifndef MNTTYPE_AUTOFS -#define MNTTYPE_AUTOFS "autofs" -#endif - -#ifndef BLOCK_SIZE -#define BLOCK_SIZE 1024 -#endif - -#define MAXQUOTAS 2 -#define USRQUOTA 0 /* element used for user quotas */ -#define GRPQUOTA 1 /* element used for group quotas */ - -struct dqblk { - u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ - u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */ - u_int32_t dqb_curblocks; /* current block count */ - u_int32_t dqb_ihardlimit; /* maximum # allocated inodes */ - u_int32_t dqb_isoftlimit; /* preferred inode limit */ - u_int32_t dqb_curinodes; /* current # allocated inodes */ - time_t dqb_btime; /* time limit for excessive disk use */ - time_t dqb_itime; /* time limit for excessive files */ -}; - -struct if_dqblk { - u_int64_t dqb_bhardlimit; - u_int64_t dqb_bsoftlimit; - u_int64_t dqb_curspace; - u_int64_t dqb_ihardlimit; - u_int64_t dqb_isoftlimit; - u_int64_t dqb_curinodes; - u_int64_t dqb_btime; - u_int64_t dqb_itime; - u_int32_t dqb_valid; -}; - -#define SUBCMDMASK 0x00ff -#define SUBCMDSHIFT 8 -#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) - -#define Q_GETQUOTA 0x0300 /* get limits and usage */ -#define Q_SETQUOTA 0x0400 /* set limits and usage */ - -#define Q_GETFMT 0x800004 /* get quota format used on given filesystem */ -#define Q_GETQUOTA_NEW 0x800007 /* get user quota structure */ -#define Q_SETQUOTA_NEW 0x800008 /* set user quota structure */ -#define dqoff(UID) ((loff_t)((UID) * sizeof (struct dqblk))) - -extern int quotactl (int __cmd, const char *__special, int __id, - caddr_t __addr) __THROW; -/* - * Global unix authentication credentials. - */ -extern struct authunix_parms *unix_cred; - -int in_group (gid_t *gids, u_int len, gid_t gid) -{ - int cnt = 0; - - while (cnt < len) { - if (gids[cnt] == gid) - return 1; - cnt++; - } - return 0; -} - -getquota_rslt *getquotainfo(int flags, caddr_t *argp, struct svc_req *rqstp) -{ - static getquota_rslt result; - union { - getquota_args *args; - ext_getquota_args *ext_args; - } arguments; - FILE *fp; - struct mntent *mnt; - char *pathname, *qfpathname; - int fd, err, id, type; - struct stat stm, stn; - struct rquota *rquota; - struct if_dqblk dqb; - - /* - * First check authentication. - */ - if (flags & TYPE_EXTENDED) { - arguments.ext_args = (ext_getquota_args *)argp; - id = arguments.ext_args->gqa_id; - type = arguments.ext_args->gqa_type; - pathname = arguments.ext_args->gqa_pathp; - - if (type == USRQUOTA && unix_cred->aup_uid && unix_cred->aup_uid != id) { - result.status = Q_EPERM; - return(&result); - } - - if (type == GRPQUOTA && unix_cred->aup_uid && unix_cred->aup_gid != id && - !in_group((gid_t *)unix_cred->aup_gids, unix_cred->aup_len, id)) { - result.status = Q_EPERM; - return(&result); - } - } else { - arguments.args = (getquota_args *)argp; - id = arguments.args->gqa_uid; - type = USRQUOTA; - pathname = arguments.args->gqa_pathp; - - if (unix_cred->aup_uid && unix_cred->aup_uid != id) { - result.status = Q_EPERM; - return(&result); - } - } - - fp = setmntent(MNTTAB, "r"); - while ((mnt = getmntent(fp)) != (struct mntent *)0) { - if (stat(mnt->mnt_dir, &stm) == -1) - continue; - - if (stat(pathname, &stn) == -1) - break; - else if (stm.st_dev != stn.st_dev) - continue; - - if (mnt->mnt_fsname [0] != '/' - || strcasecmp (mnt->mnt_type, MNTTYPE_NFS) == 0 - || strcasecmp (mnt->mnt_type, MNTTYPE_AUTOFS) == 0 - || strcasecmp (mnt->mnt_type, MNTTYPE_SWAP) == 0 - || strcasecmp (mnt->mnt_type, MNTTYPE_IGNORE) == 0) - break; - - /* All blocks reported are in BLOCK_SIZE. */ - result.getquota_rslt_u.gqr_rquota.rq_bsize = BLOCK_SIZE; - - if (hasquota(mnt, type, &qfpathname)) { - int fmt; - if (quotactl(QCMD(Q_GETFMT, type), mnt->mnt_fsname, 0, (caddr_t)&fmt)==0) { - /* new style interface - * Don't bother trying to read from the file - */ - err = quotactl(QCMD(Q_GETQUOTA_NEW, type), - mnt->mnt_fsname, id, (caddr_t)&dqb); - if (err) memset(&dqb, 0, sizeof(dqb)); - } else { - /* old style */ - struct dqblk dq_dqb; - - if ((err = quotactl(QCMD(Q_GETQUOTA, type), mnt->mnt_fsname, - id, (caddr_t)&dq_dqb)) == -1 - && !(flags & ACTIVE)) { - if ((fd = open(qfpathname, O_RDONLY)) < 0) - { - free(qfpathname); - continue; - } - lseek(fd, (long) dqoff(id), L_SET); - switch (read(fd, &dq_dqb, sizeof(struct dqblk))) { - case 0:/* EOF */ - /* - * Convert implicit 0 quota (EOF) into an - * explicit one (zero'ed dqblk) - */ - memset((caddr_t)&dq_dqb, 0, sizeof(struct dqblk)); - break; - case sizeof(struct dqblk): /* OK */ - break; - default: /* ERROR */ - close(fd); - free(qfpathname); - continue; - } - close(fd); - } - dqb.dqb_bhardlimit = dq_dqb.dqb_bhardlimit; - dqb.dqb_bsoftlimit = dq_dqb.dqb_bsoftlimit; - dqb.dqb_curspace = dq_dqb.dqb_curblocks * 1024; - dqb.dqb_ihardlimit = dq_dqb.dqb_ihardlimit; - dqb.dqb_isoftlimit = dq_dqb.dqb_isoftlimit; - dqb.dqb_curinodes = dq_dqb.dqb_curinodes; - dqb.dqb_btime = dq_dqb.dqb_btime; - dqb.dqb_itime = dq_dqb.dqb_itime; - } - free(qfpathname); - endmntent(fp); - - if (err && (flags & ACTIVE)) { - result.status = Q_NOQUOTA; - return(&result); - } - - result.status = Q_OK; - result.getquota_rslt_u.gqr_rquota.rq_active = (err == 0) ? TRUE : FALSE; - /* - * Make a copy of the info into the last part of the remote quota - * struct might not be exactly the same on all architectures... - */ - - rquota = &result.getquota_rslt_u.gqr_rquota; - rquota->rq_bhardlimit = dqb.dqb_bhardlimit; - rquota->rq_bsoftlimit = dqb.dqb_bsoftlimit;; - rquota->rq_curblocks = dqb.dqb_curspace/1024; - rquota->rq_fhardlimit = dqb.dqb_ihardlimit; - rquota->rq_fsoftlimit = dqb.dqb_isoftlimit; - rquota->rq_curfiles = dqb.dqb_curinodes; - rquota->rq_btimeleft = dqb.dqb_btime; - rquota->rq_ftimeleft = dqb.dqb_itime; - - return(&result); - } - } - endmntent(fp); - - result.status = Q_NOQUOTA; - return(&result); -} - -getquota_rslt *rquotaproc_getquota_1_svc(getquota_args *argp, struct svc_req *rqstp) -{ - return(getquotainfo(0, (caddr_t *)argp, rqstp)); -} - -getquota_rslt *rquotaproc_getactivequota_1_svc(getquota_args *argp, struct svc_req *rqstp) -{ - return(getquotainfo(ACTIVE, (caddr_t *)argp, rqstp)); -} - -getquota_rslt *rquotaproc_getquota_2_svc(ext_getquota_args *argp, struct svc_req *rqstp) -{ - return(getquotainfo(TYPE_EXTENDED, (caddr_t *)argp, rqstp)); -} - -getquota_rslt *rquotaproc_getactivequota_2_svc(ext_getquota_args *argp, struct svc_req *rqstp) -{ - return(getquotainfo(TYPE_EXTENDED | ACTIVE, (caddr_t *)argp, rqstp)); -} diff --git a/utils/rquotad/rquota_svc.c b/utils/rquotad/rquota_svc.c deleted file mode 100644 index bd2038f..0000000 --- a/utils/rquotad/rquota_svc.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * QUOTA An implementation of the diskquota system for the LINUX - * operating system. QUOTA is implemented using the BSD systemcall - * interface as the means of communication with the user level. - * Should work for all filesystems because of integration into the - * VFS layer of the operating system. - * This is based on the Melbourne quota system wich uses both user and - * group quota files. - * - * This part accepts the rquota rpc-requests. - * - * Version: $Id: rquota_svc.c,v 2.6 1996/11/17 16:59:46 mvw Exp mvw $ - * - * Author: Marco van Wieringen - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef HAVE_TCP_WRAPPER -#include "tcpwrapper.h" -#endif - -#include -#include -#include -#include "rquota.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __STDC__ -#define SIG_PF void(*)(int) -#endif - -static struct option longopts[] = -{ - { "help", 0, 0, 'h' }, - { "version", 0, 0, 'v' }, - { "port", 1, 0, 'p' }, - { NULL, 0, 0, 0 } -}; - -/* - * Global authentication credentials. - */ -struct authunix_parms *unix_cred; - -static void rquotaprog_1(struct svc_req *rqstp, register SVCXPRT *transp) -{ - union { - getquota_args rquotaproc_getquota_1_arg; - getquota_args rquotaproc_getactivequota_1_arg; - } argument; - char *result; - xdrproc_t xdr_argument, xdr_result; - char *(*local)(char *, struct svc_req *); - -#ifdef HAVE_TCP_WRAPPER - /* remote host authorization check */ - if (!check_default("rquotad", svc_getcaller(transp), - rqstp->rq_proc, RQUOTAPROG)) { - svcerr_auth (transp, AUTH_FAILED); - return; - } -#endif - - /* - * Don't bother authentication for NULLPROC. - */ - if (rqstp->rq_proc == NULLPROC) { - (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL); - return; - } - - /* - * First get authentication. - */ - switch (rqstp->rq_cred.oa_flavor) { - case AUTH_UNIX: - unix_cred = (struct authunix_parms *)rqstp->rq_clntcred; - break; - case AUTH_NULL: - default: - svcerr_weakauth(transp); - return; - } - - switch (rqstp->rq_proc) { - case RQUOTAPROC_GETQUOTA: - xdr_argument = (xdrproc_t) xdr_getquota_args; - xdr_result = (xdrproc_t) xdr_getquota_rslt; - local = (char *(*)(char *, struct svc_req *)) rquotaproc_getquota_1_svc; - break; - - case RQUOTAPROC_GETACTIVEQUOTA: - xdr_argument = (xdrproc_t) xdr_getquota_args; - xdr_result = (xdrproc_t) xdr_getquota_rslt; - local = (char *(*)(char *, struct svc_req *)) rquotaproc_getactivequota_1_svc; - break; - - default: - svcerr_noproc(transp); - return; - } - - (void) memset((char *)&argument, 0, sizeof (argument)); - if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) { - svcerr_decode(transp); - return; - } - result = (*local)((char *)&argument, rqstp); - if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { - svcerr_systemerr(transp); - } - - if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) { - syslog(LOG_ERR, "unable to free arguments"); - exit(1); - } - return; -} - -static void rquotaprog_2(struct svc_req *rqstp, register SVCXPRT *transp) -{ - union { - ext_getquota_args rquotaproc_getquota_2_arg; - ext_getquota_args rquotaproc_getactivequota_2_arg; - } argument; - char *result; - xdrproc_t xdr_argument, xdr_result; - char *(*local)(char *, struct svc_req *); - -#ifdef HAVE_TCP_WRAPPER - /* remote host authorization check */ - if (!check_default("rquotad", svc_getcaller(transp), - rqstp->rq_proc, RQUOTAPROG)) { - svcerr_auth (transp, AUTH_FAILED); - return; - } -#endif - - /* - * Don't bother authentication for NULLPROC. - */ - if (rqstp->rq_proc == NULLPROC) { - (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL); - return; - } - - /* - * First get authentication. - */ - switch (rqstp->rq_cred.oa_flavor) { - case AUTH_UNIX: - unix_cred = (struct authunix_parms *)rqstp->rq_clntcred; - break; - case AUTH_NULL: - default: - svcerr_weakauth(transp); - return; - } - - switch (rqstp->rq_proc) { - case RQUOTAPROC_GETQUOTA: - xdr_argument = (xdrproc_t) xdr_ext_getquota_args; - xdr_result = (xdrproc_t) xdr_getquota_rslt; - local = (char *(*)(char *, struct svc_req *)) rquotaproc_getquota_2_svc; - break; - - case RQUOTAPROC_GETACTIVEQUOTA: - xdr_argument = (xdrproc_t) xdr_ext_getquota_args; - xdr_result = (xdrproc_t) xdr_getquota_rslt; - local = (char *(*)(char *, struct svc_req *)) rquotaproc_getactivequota_2_svc; - break; - - default: - svcerr_noproc(transp); - return; - } - - (void) memset((char *)&argument, 0, sizeof (argument)); - if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) { - svcerr_decode(transp); - return; - } - result = (*local)((char *)&argument, rqstp); - if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { - svcerr_systemerr(transp); - } - - if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) { - syslog(LOG_ERR, "unable to free arguments"); - exit(1); - } - return; -} - -static void -usage(const char *prog, int n) -{ - fprintf(stderr, "Usage: %s [-p|--port port] [-h|-?|--help] [-v|--version]\n", prog); - exit(n); -} - -static void -killer (int sig) -{ - (void) pmap_unset(RQUOTAPROG, RQUOTAVERS); - (void) pmap_unset(RQUOTAPROG, EXT_RQUOTAVERS); - syslog(LOG_ERR, "caught signal %d, un-registering and exiting.", sig); -} - -int main(int argc, char **argv) -{ - register SVCXPRT *transp; - int c; - int port = 0; - struct sigaction sa; - - (void) pmap_unset(RQUOTAPROG, RQUOTAVERS); - (void) pmap_unset(RQUOTAPROG, EXT_RQUOTAVERS); - - openlog("rquota", LOG_PID, LOG_DAEMON); - - while ((c = getopt_long(argc, argv, "hp:v", longopts, NULL)) != EOF) { - switch (c) { - case '?': - case 'h': - usage(argv[0], 0); - break; - case 'p': - port = atoi(optarg); - if (port < 1 || port > 65535) { - fprintf(stderr, "%s: bad port number: %s\n", - argv[0], optarg); - usage(argv[0], 1); - } - break; - case 'v': - printf("rquotad %s\n", VERSION); - exit(0); - default: - usage(argv[0], 1); - } - } - - if (chdir(NFS_STATEDIR)) { - fprintf(stderr, "%s: chdir(%s) failed: %s\n", - argv [0], NFS_STATEDIR, strerror(errno)); - - exit(1); - } - - /* WARNING: the following works on Linux and SysV, but not BSD! */ - sa.sa_handler = SIG_IGN; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); - sigaction(SIGCHLD, &sa, NULL); - - sa.sa_handler = killer; - sigaction(SIGHUP, &sa, NULL); - sigaction(SIGINT, &sa, NULL); - sigaction(SIGTERM, &sa, NULL); - - if (port) - transp = svcudp_create(makesock(port, IPPROTO_UDP)); - else - transp = svcudp_create(svcudp_socket (RQUOTAPROG, 1)); - if (transp == NULL) { - syslog(LOG_ERR, "cannot create udp service."); - exit(1); - } - if (!svc_register(transp, RQUOTAPROG, RQUOTAVERS, rquotaprog_1, IPPROTO_UDP)) { - syslog(LOG_ERR, "unable to register (RQUOTAPROG, RQUOTAVERS, udp)."); - exit(1); - } - if (!svc_register(transp, RQUOTAPROG, EXT_RQUOTAVERS, rquotaprog_2, IPPROTO_UDP)) { - syslog(LOG_ERR, "unable to register (RQUOTAPROG, EXT_RQUOTAVERS, udp)."); - exit(1); - } - - daemon(1,1); - svc_run(); - - syslog(LOG_ERR, "svc_run returned"); - exit(1); - /* NOTREACHED */ -} diff --git a/utils/rquotad/rquotad.man b/utils/rquotad/rquotad.man deleted file mode 100644 index a9a1f74..0000000 --- a/utils/rquotad/rquotad.man +++ /dev/null @@ -1,86 +0,0 @@ -.\"@(#)rquotad.8" -.TH RQUOTAD 8 "8 Mar 2001" -.SH NAME -rquotad, rpc.rquotad \- remote quota server -.SH SYNOPSIS -.B /usr/etc/rpc.rquotad [-p " port "] " -.SH DESCRIPTION -.LP -.IX "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server" -.IX daemons "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server" -.IX "user quotas" "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server" -.IX "disk quotas" "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server" -.IX "quotas" "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server" -.IX "file system" "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server" -.IX "remote procedure call services" "rquotad" "" "\fLrquotad\fP \(em remote quota server" -.BR rquotad -is an -.BR rpc (3N) -server which returns quotas for a user of a local file system -which is mounted by a remote machine over the -.SM NFS\s0. -The results are used by -.BR quota (1) -to display user quotas for remote file systems. - -The -.BR rquotad -daemon is normally started at boottime from the -.BR rc.net -script (on systems with BSD'ish scripts, e.g. Slackware), or from the -.BR nfs -script in -.BR /etc/rc.d/init.d/ -or -.BR /etc/init.d/ -(on systems with SysV'ish scripts, e.g. RedHat, SuSE, etc). - -.SH OPTIONS -.TP -.BI "\-p," "" " \-\-port " port -specify a port for -.BR rpc.rquotad -to listen on. By default, -.BR rpc.rquotad -will ask -.BR portmap (8) -to assign it a port number. As of this writing, there is not -a standard port number that -.BR portmap -always or usually assigns. Specifying -a port may be useful when implementing a firewall. - -.SH TCP_WRAPPERS SUPPORT -This -.BR rpc.rquotad -version is protected by the -.BR tcp_wrapper -library. You have to give the clients access to -.BR rpc.rquotad -if they should be allowed to use it. To allow connects from clients of -the .bar.com domain you could use the following line in /etc/hosts.allow: - -mountd: .bar.com - -You have to use the daemon name -.BR rquotad -for the daemon name (even if the binary has a different name). - -For further information please have a look at the -.BR tcpd (8) -and -.BR hosts_access (5) -manual pages. - -.SH FILES -.BR quota.user , -.BR quota.group --- quota files locate in the file system's root -.PD -.SH "SEE ALSO" -.BR quota (8), -.BR rpc (3N), -.BR nfs (5), -.BR services (5), -.BR portmap(8), -.BR inetd (8)