diff options
author | chip <chip> | 2001-11-22 01:32:54 +0000 |
---|---|---|
committer | chip <chip> | 2001-11-22 01:32:54 +0000 |
commit | 13e118068de064b9bd69c629b74ccb11745c20c9 (patch) | |
tree | 03575791b98170435c4cf91cade6bbb51ddacab5 /support/nfs/clients.c | |
parent | 9743207017ccface520f839fb573ddef22e464ed (diff) | |
download | nfs-utils-13e118068de064b9bd69c629b74ccb11745c20c9.tar.gz nfs-utils-13e118068de064b9bd69c629b74ccb11745c20c9.tar.xz nfs-utils-13e118068de064b9bd69c629b74ccb11745c20c9.zip |
2001-11-21 Chip Salzenberg <chip@pobox.com>
* support/nfs/clients.c (cfname): Added: current clients file name.
(setnfsclntent): Set it.
({get,end}nfsclntent, syntaxerr): Use it.
* support/nfs/exports.c (efname): Added: current exports file name.
(setnfsexportent): Set it.
(endnfsexportent, parseopts, getexport, syntaxerr): Use it.
Diffstat (limited to 'support/nfs/clients.c')
-rw-r--r-- | support/nfs/clients.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/support/nfs/clients.c b/support/nfs/clients.c index b1970e0..9f022b6 100644 --- a/support/nfs/clients.c +++ b/support/nfs/clients.c @@ -18,6 +18,7 @@ #include "exportfs.h" #include "xio.h" +static char *cfname = NULL; static XFILE *cfp = NULL; static int *squash_uids = NULL, *squash_gids = NULL; @@ -46,6 +47,7 @@ setnfsclntent(char *fname) fname = _PATH_NFSCLIENTS; if ((cfp = xfopen(fname)) == NULL) xlog(L_ERROR, "can't open %s for reading", fname); + cfname = strdup(fname); } struct nfsclntent * @@ -137,8 +139,9 @@ again: /* This is the anon entry */ if (!hosts) { if (strcmp(cle.c_tag, "anonymous")) { - xlog(L_ERROR, "nfsclients entry %s allows anonymous " - "access. Ignored.", cle.c_tag); + xlog(L_ERROR, + "%s:%d: entry %s allows anonymous access. Ignored.", + cfname, xfp->x_line, cle.c_tag); goto again; } return &cle; @@ -147,8 +150,9 @@ again: nexthost: if (*hostptr == ':' && strcmp(cle.c_tag, "anonymous")) { - xlog(L_ERROR, "nfsclients entry %s allows anonymous " - "access. Ignored.", cle.c_tag); + xlog(L_ERROR, + "%s:%d: entry %s allows anonymous access. Ignored.", + cfname, cfp->x_line, cle.c_tag); while (*hostptr == ':') hostptr++; } @@ -171,6 +175,8 @@ nexthost: void endnfsclntent(void) { + if (cfname) + free(cfname); if (cfp) xfclose(cfp); if (squash_uids) @@ -179,6 +185,7 @@ endnfsclntent(void) xfree(squash_gids); if (hosts) xfree(hosts); + cfname = NULL; cfp = NULL; squash_uids = NULL; squash_gids = NULL; @@ -307,7 +314,7 @@ getattr(char *attr, int alen, char *value, int vlen) xskip(cfp, " \t"); if ((ok = xgettok(cfp, '=', attr, alen)) < 0) - xlog(L_ERROR, "error parsing attribute"); + syntaxerr("missing attribute"); if (ok <= 0) return ok; xskip(cfp, " \t="); @@ -318,7 +325,7 @@ getattr(char *attr, int alen, char *value, int vlen) static void syntaxerr(char *msg) { - xlog(L_ERROR, "syntax error in nfsclients file (line %d): %s", - cfp->x_line, msg); + xlog(L_ERROR, "%s:%d: syntax error: %s", + cfname, cfp->x_line, msg); } |