X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=support%2Fnfs%2Fexports.c;h=ea96400d79ca73f9292855a06d593c9ae3eea716;hp=963801583e57ba99adeacfd434379453ad3bad3b;hb=e9b0bed761bc77ba046f53be2ec324c4b61357ff;hpb=57d81b9f4c7f877d64aa7e8c5bddb852e1aa32ce diff --git a/support/nfs/exports.c b/support/nfs/exports.c index 9638015..ea96400 100644 --- a/support/nfs/exports.c +++ b/support/nfs/exports.c @@ -30,10 +30,29 @@ #include "xmalloc.h" #include "xlog.h" #include "xio.h" +#include "pseudoflavors.h" #define EXPORT_DEFAULT_FLAGS \ (NFSEXP_READONLY|NFSEXP_ROOTSQUASH|NFSEXP_GATHERED_WRITES|NFSEXP_NOSUBTREECHECK) +struct flav_info flav_map[] = { + { "krb5", RPC_AUTH_GSS_KRB5 }, + { "krb5i", RPC_AUTH_GSS_KRB5I }, + { "krb5p", RPC_AUTH_GSS_KRB5P }, + { "lipkey", RPC_AUTH_GSS_LKEY }, + { "lipkey-i", RPC_AUTH_GSS_LKEYI }, + { "lipkey-p", RPC_AUTH_GSS_LKEYP }, + { "spkm3", RPC_AUTH_GSS_SPKM }, + { "spkm3i", RPC_AUTH_GSS_SPKMI }, + { "spkm3p", RPC_AUTH_GSS_SPKMP }, + { "unix", AUTH_UNIX }, + { "sys", AUTH_SYS }, + { "null", AUTH_NULL }, + { "none", AUTH_NONE }, +}; + +const int flav_map_size = sizeof(flav_map)/sizeof(flav_map[0]); + int export_errno; static char *efname = NULL; @@ -48,7 +67,6 @@ static int getpath(char *path, int len); static int parseopts(char *cp, struct exportent *ep, int warn, int *had_subtree_opt_ptr); static int parsesquash(char *list, int **idp, int *lenp, char **ep); static int parsenum(char **cpp); -static int parsemaptype(char *type); static void freesquash(void); static void syntaxerr(char *msg); @@ -94,7 +112,6 @@ getexportent(int fromkernel, int fromexports) def_ee.e_flags &= ~NFSEXP_ASYNC; def_ee.e_flags &= ~NFSEXP_GATHERED_WRITES; } - def_ee.e_maptype = CLE_MAP_IDENT; def_ee.e_anonuid = 65534; def_ee.e_anongid = 65534; def_ee.e_squids = NULL; @@ -245,21 +262,6 @@ putexportent(struct exportent *ep) xlog(L_ERROR, "unknown fsloc method for %s:%s", ep->e_hostname, ep->e_path); } - fprintf(fp, "mapping="); - switch (ep->e_maptype) { - case CLE_MAP_IDENT: - fprintf(fp, "identity,"); - break; - case CLE_MAP_UGIDD: - fprintf(fp, "ugidd,"); - break; - case CLE_MAP_FILE: - fprintf(fp, "file,"); - break; - default: - xlog(L_ERROR, "unknown mapping type for %s:%s", - ep->e_hostname, ep->e_path); - } if ((id = ep->e_squids) != NULL) { fprintf(fp, "squash_uids="); for (i = 0; i < ep->e_nsquids; i += 2) @@ -317,7 +319,6 @@ mkexportent(char *hname, char *path, char *options) static struct exportent ee; ee.e_flags = EXPORT_DEFAULT_FLAGS; - ee.e_maptype = CLE_MAP_IDENT; ee.e_anonuid = 65534; ee.e_anongid = 65534; ee.e_squids = NULL; @@ -447,12 +448,6 @@ parseopts(char *cp, struct exportent *ep, int warn, int *had_subtree_opt_ptr) ep->e_flags &= ~NFSEXP_NOACL; else if (strcmp(opt, "no_acl") == 0) ep->e_flags |= NFSEXP_NOACL; - else if (strncmp(opt, "mapping=", 8) == 0) - ep->e_maptype = parsemaptype(opt+8); - else if (strcmp(opt, "map_identity") == 0) /* old style */ - ep->e_maptype = CLE_MAP_IDENT; - else if (strcmp(opt, "map_daemon") == 0) /* old style */ - ep->e_maptype = CLE_MAP_UGIDD; else if (strncmp(opt, "anonuid=", 8) == 0) { char *oe; ep->e_anonuid = strtol(opt+8, &oe, 10); @@ -624,19 +619,6 @@ parsenum(char **cpp) return num; } -static int -parsemaptype(char *type) -{ - if (!strcmp(type, "identity")) - return CLE_MAP_IDENT; - if (!strcmp(type, "ugidd")) - return CLE_MAP_UGIDD; - if (!strcmp(type, "file")) - return CLE_MAP_FILE; - syntaxerr("invalid map type"); - return CLE_MAP_IDENT; /* default */ -} - static int getpath(char *path, int len) {