From 9f5b40b7a68fe0a2648565ecbd4b08bf60287130 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Wed, 5 Jul 2006 10:41:03 +1000 Subject: [PATCH] Remove some files that old, unused, unneeded. deleted: support/export/keys.c deleted: support/include/rpcdispatch.h deleted: support/include/rpcsec.h deleted: support/include/version.h deleted: support/include/ypupdate.h deleted: support/nfs/clients.c deleted: support/nfs/keytab.c deleted: support/nfs/ypupdate_xdr.c deleted: support/rpc/include/Makefile.am deleted: tools/rpcdebug/neat_idea.c deleted: utils/mountd/mount_xdr.c deleted: utils/rquotad/pathnames.h --- support/export/Makefile.am | 5 +- support/export/keys.c | 72 ------- support/include/Makefile.am | 6 +- support/include/rpcdispatch.h | 57 ------ support/include/rpcsec.h | 39 ---- support/include/version.h | 1 - support/include/ypupdate.h | 16 -- support/nfs/Makefile.am | 4 - support/nfs/clients.c | 331 ------------------------------- support/nfs/keytab.c | 129 ------------ support/nfs/ypupdate_xdr.c | 29 --- support/rpc/include/Makefile.am | 3 - tools/rpcdebug/Makefile.am | 2 - tools/rpcdebug/neat_idea.c | 336 -------------------------------- utils/mountd/mount_xdr.c | 81 -------- utils/rquotad/Makefile.am | 2 +- utils/rquotad/pathnames.h | 39 ---- 17 files changed, 3 insertions(+), 1149 deletions(-) delete mode 100644 support/export/keys.c delete mode 100644 support/include/rpcdispatch.h delete mode 100644 support/include/rpcsec.h delete mode 100644 support/include/version.h delete mode 100644 support/include/ypupdate.h delete mode 100644 support/nfs/clients.c delete mode 100644 support/nfs/keytab.c delete mode 100644 support/nfs/ypupdate_xdr.c delete mode 100644 support/rpc/include/Makefile.am delete mode 100644 tools/rpcdebug/neat_idea.c delete mode 100644 utils/mountd/mount_xdr.c delete mode 100644 utils/rquotad/pathnames.h diff --git a/support/export/Makefile.am b/support/export/Makefile.am index a7c7062..7a6a441 100644 --- a/support/export/Makefile.am +++ b/support/export/Makefile.am @@ -8,10 +8,7 @@ GENFILES_H = mount.h GENFILES = $(GENFILES_CLNT) $(GENFILES_SVC) $(GENFILES_XDR) $(GENFILES_H) -EXTRA_DIST = \ - mount.x \ - \ - keys.c +EXTRA_DIST = mount.x noinst_LIBRARIES = libexport.a libexport_a_SOURCES = client.c export.c hostname.c nfsctl.c rmtab.c \ diff --git a/support/export/keys.c b/support/export/keys.c deleted file mode 100644 index 4814808..0000000 --- a/support/export/keys.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * keys.c Key management for nfsd. Currently, keys - * are kept in a single file only, but eventually, - * support for a key server should be added. - * - * Copyright (C) 1995 Olaf Kirch - */ - -#include "config.h" - -#include -#include "nfslib.h" -#include "exportfs.h" -#include "xmalloc.h" - -struct keycache { - struct keycache * k_next; - struct nfskeyent k_data; -}; - -static struct keycache * keycache = NULL; -static time_t lastmod = 0; - -static void key_reload(void); - - -struct nfskey * -key_lookup(char *hname) -{ - struct keycache *kc; - - key_reload(); - - for (kc = keycache; kc; kc = kc->k_next) { -#if 0 - if (matchhostname(kc->k_data.k_hostname, hname)) -#else - if (!strcmp(kc->k_data.k_hostname, hname)) -#endif - return &kc->k_data.k_key; - } - - return NULL; -} - -static void -key_reload(void) -{ - struct stat stb; - struct keycache *cp; - struct nfskeyent *kp; - - if (stat(_PATH_NFSKEYS, &stb) >= 0 && stb.st_mtime == lastmod) - return; - - while (keycache) { - cp = keycache->k_next; - xfree(keycache); - keycache = cp; - } - - setnfskeyent(_PATH_NFSKEYS); - while ((kp = getnfskeyent()) != NULL) { - cp = (struct keycache *) xmalloc(sizeof(*cp)); - cp->k_data = *kp; - cp->k_next = keycache; - keycache = cp; - } - endnfskeyent(); - - lastmod = stb.st_mtime; -} diff --git a/support/include/Makefile.am b/support/include/Makefile.am index cdf628b..a99882c 100644 --- a/support/include/Makefile.am +++ b/support/include/Makefile.am @@ -11,15 +11,11 @@ noinst_HEADERS = \ nfs_mntent.h \ nfs_paths.h \ nfslib.h \ - rpcdispatch.h \ rpcmisc.h \ - rpcsec.h \ tcpwrapper.h \ - version.h \ xio.h \ xlog.h \ xmalloc.h \ - xcommon.h \ - ypupdate.h + xcommon.h MAINTAINERCLEANFILES = Makefile.in diff --git a/support/include/rpcdispatch.h b/support/include/rpcdispatch.h deleted file mode 100644 index 866d4bf..0000000 --- a/support/include/rpcdispatch.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * nlm_dispatch This is a generic RPC call dispatcher. - * It is loosely based on the dispatch mechanism I - * first encountered in the UNFSD source. - * - * Cyopright (C) 1995, Olaf Kirch - * - * 24.05.95 okir - * - */ - -#ifndef RPCDISPATCH_H -#define RPCDISPATCH_H - -#include - -#ifdef __STDC__ -# define CONCAT(a,b) a##b -# define CONCAT3(a,b,c) a##b##c -# define STRING(a) #a -#else -# define CONCAT(a,b) a/**/b -# define CONCAT3(a,b,c) a/**/b/**/c -# define STRING(a) "a" -#endif - -#ifdef __STDC__ -typedef bool_t (*rpcsvc_fn_t)(struct svc_req *, void *argp, void *resp); -#else -typedef bool_t (*rpcsvc_fn_t)(); -#endif - -#define table_ent(func, vers, arg_type, res_type) \ - { STRING(func), \ - (rpcsvc_fn_t)CONCAT(func,_svc), vers,\ - (xdrproc_t)CONCAT(xdr_, arg_type), sizeof(arg_type), \ - (xdrproc_t)CONCAT(xdr_, res_type), sizeof(res_type), \ - } -#define nlm_undef_svc NULL -#define xdr_nlm_void xdr_void - -struct dispatch_entry { - const char *name; - rpcsvc_fn_t func; - unsigned int versions; /* bitmap of versions */ - xdrproc_t xdr_arg_fn; /* argument XDR */ - size_t xdr_arg_size; - xdrproc_t xdr_res_fn; /* result XDR */ - size_t xdr_res_size; -}; - -void rpc_dispatch(struct svc_req *rq, SVCXPRT *tp, - struct dispatch_entry *dtable, int nproc, - void *argp, void *resp); -void rpc_svcrun(void); - -#endif /* RPCDISPATCH_H */ diff --git a/support/include/rpcsec.h b/support/include/rpcsec.h deleted file mode 100644 index 84d4497..0000000 --- a/support/include/rpcsec.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Declarations needed for the authdes library. Some of the functions - * mentioned herein have been omitted from the Linux libc header files - */ - -#ifndef RPCSEC_H -#define RPCSEC_H - -int netname2user(char *netname, int *uidp, int *gidp, - int *gidlenp, int *gidlist); -int netname2host(char *netname, char *hostname, int hostlen); -int getnetname(char *name); -int user2netname(char *netname, int uid, char *domain); -int host2netname(char *netname, char *hostname, char *domain); -void passwd2des(char *pw, char *key); -int getsecretkey(char *netname, char *secretkey, char *passwd); -int getpublickey(char *hostname, char *publickey); -int yp_update(char *domain, char *map, unsigned int ypop, - char *key, int keylen, char *data, int datalen); -int key_setsecret(char *secret); -int xencrypt(char *secret, char *passwd); -int xdecrypt(char *secret, char *passwd); - - -#define PUBLICKEY_MAP "publickey.byname" -#define NETID_MAP "netid.byname" - -#ifndef DEBUG -#define RPCSEC_BASE "/etc/" -#else -#define RPCSEC_BASE "/tmp/" -#endif - -#define PUBLICKEY_FILE RPCSEC_BASE "publickey" -#define PUBLICKEY_LOCK RPCSEC_BASE "publickey.lock" -#define ROOTKEY_FILE RPCSEC_BASE ".rootkey" -#define KEYSTORE_FILE RPCSEC_BASE "keystore" - -#endif /* RPCSEC_H */ diff --git a/support/include/version.h b/support/include/version.h deleted file mode 100644 index a74ec35..0000000 --- a/support/include/version.h +++ /dev/null @@ -1 +0,0 @@ -#define VERSION "1.4.7 (0.4.22)" diff --git a/support/include/ypupdate.h b/support/include/ypupdate.h deleted file mode 100644 index e0cee15..0000000 --- a/support/include/ypupdate.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * ypupdate.h This file contains the public declarations for the - * ypupdate client side RPC stubs. - * - * Copyright (C) 1995 Olaf Kirch - */ - -#ifndef YPUPDATE_H -#define YPUPDATE_H - -#include - -int yp_update(char *domain, char *map, unsigned int ypop, - char *key, int keylen, char *data, int datalen); - -#endif YPUPDATE_H diff --git a/support/nfs/Makefile.am b/support/nfs/Makefile.am index e844c73..af8181d 100644 --- a/support/nfs/Makefile.am +++ b/support/nfs/Makefile.am @@ -8,7 +8,3 @@ libnfs_a_SOURCES = exports.c rmtab.c xio.c rpcmisc.c rpcdispatch.c \ MAINTAINERCLEANFILES = Makefile.in -EXTRA_DIST = \ - clients.c \ - keytab.c \ - ypupdate_xdr.c diff --git a/support/nfs/clients.c b/support/nfs/clients.c deleted file mode 100644 index 9f022b6..0000000 --- a/support/nfs/clients.c +++ /dev/null @@ -1,331 +0,0 @@ -/* - * support/nfs/nfsclient.c - * - * Parse the nfsclients file. - * - * Copyright (C) 1995, 1996 Olaf Kirch - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include "xmalloc.h" -#include "nfslib.h" -#include "exportfs.h" -#include "xio.h" - -static char *cfname = NULL; -static XFILE *cfp = NULL; -static int *squash_uids = NULL, - *squash_gids = NULL; -static int squash_uidlen = 0, - squash_gidlen = 0; -static char *hosts = NULL; - -static int parsesquash(char *list, int **idp, int *lenp); -static int parsenum(char **cpp); -static int parsekey(struct nfskey *keyp, char *str); -static int hexdigit(char c); -static int gettag(char *tag, int len); -static int getattr(char *attr, int alen, char *value, int vlen); -static void syntaxerr(char *msg); - -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif - -void -setnfsclntent(char *fname) -{ - if (cfp) - xfclose(cfp); - if (!fname) - fname = _PATH_NFSCLIENTS; - if ((cfp = xfopen(fname)) == NULL) - xlog(L_ERROR, "can't open %s for reading", fname); - cfname = strdup(fname); -} - -struct nfsclntent * -getnfsclntent(void) -{ - static struct nfsclntent cle; - static char *hostptr = NULL; - char attr[32], val[512], *sp; - int ok; - - if (!cfp) - endnfsclntent(); - -again: - if (hosts) { - if (hostptr) - goto nexthost; - xfree(hosts); - hosts = NULL; - } - - if ((ok = gettag(cle.c_tag, sizeof(cle.c_tag))) < 0) - syntaxerr("expected tag"); - if (ok <= 0) - return NULL; - - cle.c_hostname[0] = '\0'; - cle.c_fhkey.k_type = CLE_KEY_NONE; - cle.c_mapping = CLE_MAP_IDENT; - cle.c_anonuid = -2; - cle.c_anongid = -2; - - if (squash_uids) - xfree(squash_uids); - if (squash_gids) - xfree(squash_gids); - squash_uids = squash_gids = NULL; - squash_uidlen = squash_gidlen = 0; - - while (ok) { - if ((ok = getattr(attr, sizeof(attr), val, sizeof(val))) < 0) - return NULL; - if (!ok) - break; - if (attr[0] == 'h' && !strcmp(attr, "hosts")) { - int l0 = hosts? strlen(hosts) : 0; - - hosts = (char *) xrealloc(hosts, l0+strlen(val)+2); - if (l0) - hosts[l0++] = ':'; - strcpy(hosts+l0, val); - } else - if (attr[0] == 'f' && !strcmp(attr, "fhmac")) { - if (!parsekey(&cle.c_fhkey, val)) - return NULL; - } else - if (attr[0] == 'm' && !strcmp(attr, "mapping")) { - if (!strcmp(val, "identity")) - cle.c_mapping = CLE_MAP_IDENT; - else if (!strcmp(val, "file")) - cle.c_mapping = CLE_MAP_FILE; - else if (!strcmp(val, "daemon")) - cle.c_mapping = CLE_MAP_UGIDD; - else { - syntaxerr("invalid mapping type"); - return NULL; - } - } else - if (attr[0] == 's' && !strcmp(attr, "squash_uids")) { - if (!parsesquash(val, &squash_uids, &squash_uidlen)) - return NULL; - } else - if (attr[0] == 's' && !strcmp(attr, "squash_gids")) { - if (!parsesquash(val, &squash_gids, &squash_gidlen)) - return NULL; - } else - if (attr[0] == 'a' && !strcmp(attr, "anonuid")) - cle.c_anonuid = atoi(val); - else - if (attr[0] == 'a' && !strcmp(attr, "anongid")) - cle.c_anongid = atoi(val); - else - syntaxerr("unknown attribute"); - } - - cle.c_squashuids = squash_uids; - cle.c_squashgids = squash_gids; - - /* This is the anon entry */ - if (!hosts) { - if (strcmp(cle.c_tag, "anonymous")) { - xlog(L_ERROR, - "%s:%d: entry %s allows anonymous access. Ignored.", - cfname, xfp->x_line, cle.c_tag); - goto again; - } - return &cle; - } - hostptr = hosts; - -nexthost: - if (*hostptr == ':' && strcmp(cle.c_tag, "anonymous")) { - xlog(L_ERROR, - "%s:%d: entry %s allows anonymous access. Ignored.", - cfname, cfp->x_line, cle.c_tag); - while (*hostptr == ':') - hostptr++; - } - - /* Ignore trailing colons */ - if (!*hostptr) { - hostptr = NULL; - goto again; - } - - sp = hostptr; - hostptr = strchr(hostptr, ':'); - if (hostptr) - *hostptr++ = '\0'; - strncpy(cle.c_hostname, sp, sizeof(cle.c_hostname) - 1); - cle.c_hostname [sizeof(cle.c_hostname) - 1] = '\0'; - return &cle; -} - -void -endnfsclntent(void) -{ - if (cfname) - free(cfname); - if (cfp) - xfclose(cfp); - if (squash_uids) - xfree(squash_uids); - if (squash_gids) - xfree(squash_gids); - if (hosts) - xfree(hosts); - cfname = NULL; - cfp = NULL; - squash_uids = NULL; - squash_gids = NULL; - hosts = NULL; -} - -static int -parsekey(struct nfskey *keyp, char *str) -{ - char *sp; - int i, l, x0, x1; - - - if ((sp = strchr(str, ':')) != NULL) - *sp++ = '\0'; - if (!strcmp(str, "null")) - keyp->k_type = CLE_KEY_NULL; - else if (!strcmp(str, "md5")) - keyp->k_type = CLE_KEY_MD5; - else if (!strcmp(str, "sha")) - keyp->k_type = CLE_KEY_SHA; - else { - syntaxerr("unknown key type"); - return 0; - } - if (keyp->k_type == CLE_KEY_NULL) { - keyp->k_len = 0; - if (sp) - syntaxerr("unexpected key data for null key"); - return sp? 0 : 1; - } else if (sp) { - if ((l = strlen(sp)) & 1) { - syntaxerr("odd key length"); - return 0; - } - - l >>= 1; - for (i = 0; i < l && i < sizeof(keyp->k_key); i++, sp += 2) { - if ((x0 = hexdigit(sp[0])) == 0xff || - (x1 = hexdigit(sp[1])) == 0xff) { - syntaxerr("bad key digit"); - return 0; - } - keyp->k_key[i] = (x0 << 4) | x1; - } - keyp->k_len = i; - return 1; - } - return 0; -} - -static int -hexdigit(char c) -{ - if ((c = tolower(c)) >= '0' && c <= '9') - return c - '0'; - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - return 0xff; -} - -static int -parsesquash(char *list, int **idp, int *lenp) -{ - char *cp = list; - int id0, id1; - int len = *lenp; - int *id = *idp; - - do { - id0 = parsenum(&cp); - if (*cp == '-') { - cp++; - id1 = parsenum(&cp); - } else { - id1 = id0; - } - if (id0 == -1 || id1 == -1) { - syntaxerr("uid/gid -1 not permitted"); - return 0; - } - if ((len % 8) == 0) - id = (int *) xrealloc(id, (len + 9) * sizeof(*id)); - id[len++] = id0; - id[len++] = id1; - if (!*cp) - break; - if (*cp != ',') { - syntaxerr("bad uid/gid list"); - return 0; - } - cp++; - } while(1); - - id[len] = -1; - *lenp = len; - *idp = id; - return 1; -} - -static int -parsenum(char **cpp) -{ - char *cp = *cpp, c; - int num = 0; - - if (**cpp == '-') - (*cpp)++; - while (isdigit(**cpp)) - (*cpp)++; - c = **cpp; **cpp = '\0'; num = atoi(cp); **cpp = c; - return num; -} - -static int -gettag(char *tag, int len) -{ - xskip(cfp, " \t\n"); - return xgettok(cfp, ':', tag, len); -} - -static int -getattr(char *attr, int alen, char *value, int vlen) -{ - int ok; - - xskip(cfp, " \t"); - if ((ok = xgettok(cfp, '=', attr, alen)) < 0) - syntaxerr("missing attribute"); - if (ok <= 0) - return ok; - xskip(cfp, " \t="); - - return xgettok(cfp, 0, value, vlen); -} - -static void -syntaxerr(char *msg) -{ - xlog(L_ERROR, "%s:%d: syntax error: %s", - cfname, cfp->x_line, msg); -} - diff --git a/support/nfs/keytab.c b/support/nfs/keytab.c deleted file mode 100644 index e33dded..0000000 --- a/support/nfs/keytab.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * support/nfs/keytab.c - * - * Manage the nfskeys database. - * - * Copyright (C) 1995, 1996 Olaf Kirch - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include "xmalloc.h" -#include "nfslib.h" -#include "exportfs.h" -#include "xio.h" - -static FILE *cfp = NULL; - -int -setnfskeyent(char *fname) -{ - if (cfp) - fclose(cfp); - if (!fname) - fname = _PATH_NFSKEYS; - cfp = fsetnfskeyent(fname, "r"); - return cfp != NULL; -} - -FILE * -fsetnfskeyent(char *fname, char *type) -{ -#if 0 - FILE *fp; - - if ((fp = fopen(fname, type)) == NULL) - xlog(L_ERROR, "can't open %s for %sing\n", - fname, type[0] == 'r'? "read" : "writ"); - return fp; -#else - return fopen(fname, type); -#endif -} - -struct nfskeyent * -getnfskeyent(void) -{ - return fgetnfskeyent(cfp); -} - -struct nfskeyent * -fgetnfskeyent(FILE *fp) -{ - static struct nfskeyent ke; - - if (!fp) - return NULL; - - do { - if (fread(&ke, sizeof(ke), 1, fp) != 1) - return NULL; - } while(ke.k_hostname[0] == '\0'); - return &ke; -} - -void -endnfskeyent(void) -{ - if (cfp) - fclose(cfp); - cfp = NULL; -} - -void -fendnfskeyent(FILE *fp) -{ - if (fp) - fclose(fp); -} - -void -fputnfskeyent(FILE *fp, struct nfskeyent *kep) -{ - fwrite(kep, sizeof(*kep), 1, fp); -} - -int -getnfskeytype(char *st) -{ - if (!strcasecmp(st, "null")) - return CLE_KEY_NULL; - if (!strcasecmp(st, "md5")) - return CLE_KEY_MD5; - if (!strcasecmp(st, "sha")) - return CLE_KEY_SHA; - return CLE_KEY_NONE; -} - -char * -getnfskeyname(int type) -{ - switch (type) { - case CLE_KEY_NONE: - return "none"; - case CLE_KEY_NULL: - return "null"; - case CLE_KEY_MD5: - return "md5"; - case CLE_KEY_SHA: - return "sha"; - } - return "unk"; -} - -int -getnfskeysize(int type) -{ - switch (type) { - case CLE_KEY_MD5: - return 16; - case CLE_KEY_SHA: - return 20; - } - return 0; -} diff --git a/support/nfs/ypupdate_xdr.c b/support/nfs/ypupdate_xdr.c deleted file mode 100644 index 9fe1098..0000000 --- a/support/nfs/ypupdate_xdr.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * support/nfs/ypupdate_xdr.c - * - * This file contains the XDR code for the ypupdate protocol. - * - * Copyright (C) 1995, 1996 Olaf Kirch - */ - -#include "config.h" - -#include - -bool_t -xdr_ypupdate_args(XDR *xdrs, ypupdate_args *objp) -{ - return xdr_string(xdrs, &objp->mapname, MAXMAPNAMELEN) && - xdr_bytes(xdrs, &objp->key.yp_buf_val, - &objp->key.yp_buf_len, MAXYPDATALEN) && - xdr_bytes(xdrs, &objp->datum.yp_buf_val, - &objp->datum.yp_buf_len, MAXYPDATALEN); -} - -bool_t -xdr_ypdelete_args(XDR *xdrs, ypdelete_args *objp) -{ - return xdr_string(xdrs, &objp->mapname, MAXMAPNAMELEN) && - xdr_bytes(xdrs, &objp->key.yp_buf_val, - &objp->key.yp_buf_len, MAXYPDATALEN); -} diff --git a/support/rpc/include/Makefile.am b/support/rpc/include/Makefile.am deleted file mode 100644 index fef4b5e..0000000 --- a/support/rpc/include/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -## Process this file with automake to produce Makefile.in - -SUBDIRS = rpc diff --git a/tools/rpcdebug/Makefile.am b/tools/rpcdebug/Makefile.am index 409c98f..65def67 100644 --- a/tools/rpcdebug/Makefile.am +++ b/tools/rpcdebug/Makefile.am @@ -3,8 +3,6 @@ CC=$(CC_FOR_BUILD) LIBTOOL = @LIBTOOL@ --tag=CC -EXTRA_DIST= neat_idea.c - noinst_PROGRAMS = rpcdebug rpcdebug_SOURCES = rpcdebug.c rpcdebug_CFLAGS=$(CFLAGS_FOR_BUILD) diff --git a/tools/rpcdebug/neat_idea.c b/tools/rpcdebug/neat_idea.c deleted file mode 100644 index 7ca9d6f..0000000 --- a/tools/rpcdebug/neat_idea.c +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Get or set RPC debug flags. - * - * I would have loved to write this without recourse to the sysctl - * interface, but the only plausible approach (reading and writing - * /dev/kmem at the offsets indicated by the *_debug symbols from - * /proc/ksyms) didn't work, because /dev/kmem doesn't translate virtual - * addresses on write. Unfortunately, modules are stuffed into memory - * allocated via vmalloc. - * - * Copyright (C) 1996, Olaf Kirch - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include "nfslib.h" - -static int verbose = 0; -static int memfd; -static off_t flagpos; - -static void find_offset(char *module); -static unsigned int find_flag(char **module, char *name); -static unsigned int get_flags(void); -static void set_flags(unsigned int value); -static void print_flags(char *module, unsigned int flags); -static void usage(int excode); - -int -main(int argc, char **argv) -{ - int opt_s = 0, - opt_c = 0; - unsigned int flags = 0, oflags; - char * module = NULL; - int c; - - while ((c = getopt(argc, argv, "chm:sv")) != EOF) { - switch (c) { - case 'c': - opt_c = 1; - break; - case 'h': - usage(0); - case 'm': - module = optarg; - break; - case 's': - opt_s = 1; - break; - case 'v': - verbose++; - break; - default: - fprintf(stderr, "rpcdebug: unknown option -%c\n", - optopt); - usage(1); - } - } - - if (opt_c + opt_s > 1) { - fprintf(stderr, "You can use at most one of -c and -s\n"); - usage(1); - } - - if (argc == optind) { - flags = ~(unsigned int) 0; - } else { - for (; optind < argc; optind++) { - unsigned int temp; - - if (!(temp = find_flag(&module, argv[optind]))) { - fprintf(stderr, "rpcdebug: unknown flag %s\n", - argv[optind]); - exit(1); - } - flags |= temp; - } - } - - if (!module) { - fprintf(stderr, "rpcdebug: no module name specified, and " - "could not be inferred.\n"); - usage(1); - } - - if ((memfd = open("/dev/kmem", O_RDWR)) < 0) { - perror("can't open /dev/mem"); - exit(1); - } - - find_offset(module); - - oflags = get_flags(); - - if (opt_c) { - set_flags(oflags & ~flags); - } else if (opt_s) { - set_flags(oflags | flags); - } else { - print_flags(module, oflags); - } - - close(memfd); - return 0; -} - -#define FLAG(mname, fname) \ - { #mname, #fname, mname##DBG_##fname } - -static struct flagmap { - char * module; - char * name; - unsigned int value; -} flagmap[] = { - /* rpc */ - FLAG(RPC, XPRT), - FLAG(RPC, CALL), - FLAG(RPC, TYPES), - FLAG(RPC, NFS), - FLAG(RPC, AUTH), - FLAG(RPC, PMAP), - FLAG(RPC, SCHED), - FLAG(RPC, SVCSOCK), - FLAG(RPC, SVCDSP), - FLAG(RPC, MISC), - FLAG(RPC, ALL), - - /* nfs */ - /* currently handled by RPCDBG_NFS */ - - /* nfsd */ - FLAG(NFSD, SOCK), - FLAG(NFSD, FH), - FLAG(NFSD, EXPORT), - FLAG(NFSD, SVC), - FLAG(NFSD, PROC), - FLAG(NFSD, FILEOP), - FLAG(NFSD, AUTH), - FLAG(NFSD, REPCACHE), - FLAG(NFSD, XDR), - FLAG(NFSD, LOCKD), - FLAG(NFSD, ALL), - - /* lockd */ - FLAG(NLM, SVC), - FLAG(NLM, CLIENT), - FLAG(NLM, CLNTLOCK), - FLAG(NLM, SVCLOCK), - FLAG(NLM, MONITOR), - FLAG(NLM, CLNTSUBS), - FLAG(NLM, SVCSUBS), - FLAG(NLM, ALL), - - { NULL, NULL, 0 } -}; - -static unsigned int -find_flag(char **module, char *name) -{ - char *mod = *module; - unsigned int value = 0; - int i; - - for (i = 0; flagmap[i].module; i++) { - if ((mod && strcasecmp(mod, flagmap[i].module)) - || strcasecmp(name, flagmap[i].name)) - continue; - if (value) { - fprintf(stderr, - "rpcdebug: ambiguous symbol name %s.\n" - "This name is used by more than one module, " - "please specify the module name using\n" - "the -m option.\n", - name); - usage(1); - } - value = flagmap[i].value; - if (*module) - return value; - mod = flagmap[i].module; - } - - *module = mod; - return value; -} - -static unsigned int -get_flags(void) -{ - unsigned int value; - int count; - - if (lseek(memfd, flagpos, SEEK_SET) < 0) { - perror("lseek"); - exit(1); - } - if ((count = read(memfd, &value, sizeof(value))) < 0) { - perror("read"); - exit(1); - } - if (count != sizeof(value)) { - fprintf(stderr, "read failed (only %d bytes read)\n", - count); - exit(1); - } - if (verbose) - printf("getting flags 0x%x\n", value); - return value; -} - -static void -set_flags(unsigned int value) -{ - int count; - - if (verbose) - printf("setting flags 0x%x\n", value); - if (lseek(memfd, flagpos, SEEK_SET) < 0) { - perror("lseek"); - exit(1); - } - if ((count = write(memfd, &value, sizeof(value))) < 0) { - perror("write"); - exit(1); - } - if (count != sizeof(value)) { - fprintf(stderr, "write failed (only %d bytes written)\n", - count); - exit(1); - } -} - -static void -find_offset(char *module) -{ - char buffer[512], *sp; - char symbol[64]; - FILE *fp; - int len; - - len = sprintf(symbol, "%s_debug", module); - - if ((fp = fopen("/proc/ksyms", "r")) < 0) { - perror("rpcdebug: can't open /proc/ksyms"); - exit(1); - } - - while (fgets(buffer, sizeof(buffer), fp) != NULL) { - if (!(sp = strchr(buffer, ' '))) - continue; - if (strncmp(++sp, symbol, len)) - continue; - if (sp[len] != '\n' && sp[len] != '\t' - && strncmp(sp+len, "_R", 2)) - continue; - flagpos = (unsigned long) strtol(buffer, &sp, 16); - /* printf("position is %lx\n", flagpos); */ - if (sp && *sp == ' ') - return; - fprintf(stderr, "rpcdebug: weird line in /proc/ksyms: %s\n", - buffer); - exit(1); - } - - fprintf(stderr, "rpcdebug: debug symbol for module %s not found.\n", - module); - exit(1); -} - -static char * -strtolower(char *str) -{ - static char temp[64]; - char *sp; - - strcpy(temp, str); - for (sp = temp; *sp; sp++) - *sp = tolower(*sp); - return temp; -} - -static void -print_flags(char *module, unsigned int flags) -{ - char *lastmod = NULL; - int i; - - if (module) { - printf("%-10s", strtolower(module)); - if (!flags) { - printf("\n"); - return; - } - /* printf(" <%x>", flags); */ - } - - for (i = 0; flagmap[i].module; i++) { - if (module) { - if (strcasecmp(flagmap[i].module, module)) - continue; - } else if (!lastmod || strcmp(lastmod, flagmap[i].module)) { - if (lastmod) - printf("\n"); - printf("%-10s", strtolower(flagmap[i].module)); - lastmod = flagmap[i].module; - } - if (!(flags & flagmap[i].value) - || (module && !strcasecmp(flagmap[i].name, "all"))) - continue; - printf(" %s", strtolower(flagmap[i].name)); - } - printf("\n"); -} - -static void -usage(int excode) -{ - fprintf(stderr, "usage: rpcdebug [-m module] [-cs] flags ...\n"); - if (verbose) { - printf("\nModule Valid flags\n"); - print_flags(NULL, ~(unsigned int) 0); - } - exit (excode); -} - diff --git a/utils/mountd/mount_xdr.c b/utils/mountd/mount_xdr.c deleted file mode 100644 index a0fefcb..0000000 --- a/utils/mountd/mount_xdr.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * mount_xdr XDR procedures for mountd. - * - * Originally generated by rpcgen; edited to get rid of warnings. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include - -inline bool_t -xdr_fhandle(XDR *xdrs, fhandle objp) -{ - return xdr_opaque(xdrs, objp, FHSIZE); -} - -bool_t -xdr_fhstatus(XDR *xdrs, fhstatus *objp) -{ - return xdr_u_int(xdrs, &objp->fhs_status) && - (objp->fhs_status != 0 || - xdr_fhandle(xdrs, objp->fhstatus_u.fhs_fhandle)); -} - -bool_t -xdr_dirpath(XDR *xdrs, dirpath *objp) -{ - return xdr_string(xdrs, objp, MNTPATHLEN); -} - -inline bool_t -xdr_name(XDR *xdrs, name *objp) -{ - return xdr_string(xdrs, objp, MNTPATHLEN); -} - -bool_t -xdr_mountlist(XDR *xdrs, mountlist *objp) -{ - return xdr_pointer(xdrs, (char **)objp, sizeof(struct mountbody), - (xdrproc_t)xdr_mountbody); -} - -bool_t -xdr_mountbody(XDR *xdrs, mountbody *objp) -{ - return xdr_name(xdrs, &objp->ml_hostname) && - xdr_dirpath(xdrs, &objp->ml_directory) && - xdr_mountlist(xdrs, &objp->ml_next); -} - -bool_t -xdr_groups(XDR *xdrs, groups *objp) -{ - return xdr_pointer(xdrs, (char **)objp, sizeof(struct groupnode), - (xdrproc_t)xdr_groupnode); -} - -bool_t -xdr_groupnode(XDR *xdrs, groupnode *objp) -{ - return xdr_name(xdrs, &objp->gr_name) && - xdr_groups(xdrs, &objp->gr_next); -} - -bool_t -xdr_exports(XDR *xdrs, exports *objp) -{ - return xdr_pointer(xdrs, (char **)objp, sizeof(struct exportnode), - (xdrproc_t)xdr_exportnode); -} - -bool_t -xdr_exportnode(XDR *xdrs, exportnode *objp) -{ - return xdr_dirpath(xdrs, &objp->ex_dir) && - xdr_groups(xdrs, &objp->ex_groups) && - xdr_exports(xdrs, &objp->ex_next); -} diff --git a/utils/rquotad/Makefile.am b/utils/rquotad/Makefile.am index b478fad..8e3e634 100644 --- a/utils/rquotad/Makefile.am +++ b/utils/rquotad/Makefile.am @@ -9,7 +9,7 @@ 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 pathnames.h rquota.h + hasquota.c mntent.h rquota.h rquotad_LDADD = ../../support/export/libexport.a \ ../../support/nfs/libnfs.a \ ../../support/misc/libmisc.a \ diff --git a/utils/rquotad/pathnames.h b/utils/rquotad/pathnames.h deleted file mode 100644 index 6604a18..0000000 --- a/utils/rquotad/pathnames.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1989 The Regents of the University of California. - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. - * - * @@(#)pathnames.h 5.3 (Berkeley) 6/1/90 - */ - -#include - -#undef _PATH_TMP -#define _PATH_TMP "/tmp/EdP.aXXXXXX" -- 2.39.2