nfs-ganesha 1.4
Classes | Defines | Typedefs | Enumerations | Functions

nfs_exports.h File Reference

Prototypes for what's related to export list management. More...

#include <pthread.h>
#include <sys/types.h>
#include <sys/param.h>
#include "ganesha_rpc.h"
#include <dirent.h>
#include <netdb.h>
#include "HashData.h"
#include "HashTable.h"
#include "nfs23.h"
#include "nfs4.h"
#include "mount.h"
#include "nfs_stat.h"
#include "cache_inode.h"
#include "nfs_ip_stats.h"
#include "nlm_list.h"

Go to the source code of this file.

Classes

struct  exportlist_client_hostif__
struct  exportlist_client_net__
struct  exportlist_client_netgrp__
struct  exportlist_client_wildcard_host__
struct  exportlist_client_gss__
union  exportlist_client_union__
struct  exportlist_client_entry__
struct  exportlist_client__
struct  exportlist__
struct  pseudofs_entry
struct  pseudofs
struct  nfs_client_cred_gss__
struct  nfs_client_cred__
struct  compoud_data
 Compound data. More...

Defines

#define EXPORT_KEY_SIZE   8
#define ANON_UID   -2
#define ANON_GID   -2
#define EXPORT_LINESIZE   1024
#define INPUT_SIZE   1024
#define GSS_DEFINE_LEN_TEMP   255
#define EXPORTS_NB_MAX_CLIENTS   128
#define EXPORT_OPTION_NOSUID   0x00000001
#define EXPORT_OPTION_NOSGID   0x00000002
#define EXPORT_OPTION_ROOT   0x00000004
#define EXPORT_OPTION_NETENT   0x00000008
#define EXPORT_OPTION_READ_ACCESS   0x00000010
#define EXPORT_OPTION_NETGRP   0x00000020
#define EXPORT_OPTION_WILDCARD   0x00000040
#define EXPORT_OPTION_GSSPRINC   0x00000080
#define EXPORT_OPTION_PSEUDO   0x00000100
#define EXPORT_OPTION_MAXREAD   0x00000200
#define EXPORT_OPTION_MAXWRITE   0x00000400
#define EXPORT_OPTION_PREFREAD   0x00000800
#define EXPORT_OPTION_PREFWRITE   0x00001000
#define EXPORT_OPTION_PREFRDDIR   0x00002000
#define EXPORT_OPTION_PRIVILEGED_PORT   0x00004000
#define EXPORT_OPTION_USE_DATACACHE   0x00008000
#define EXPORT_OPTION_WRITE_ACCESS   0x00010000
#define EXPORT_OPTION_MD_WRITE_ACCESS   0x00020000
#define EXPORT_OPTION_MD_READ_ACCESS   0x00040000
#define EXPORT_OPTION_AUTH_NONE   0x00010000
#define EXPORT_OPTION_AUTH_UNIX   0x00020000
#define EXPORT_OPTION_RPCSEC_GSS_NONE   0x00040000
#define EXPORT_OPTION_RPCSEC_GSS_INTG   0x00080000
#define EXPORT_OPTION_RPCSEC_GSS_PRIV   0x00100000
#define EXPORT_OPTION_NFSV2   0x00200000
#define EXPORT_OPTION_NFSV3   0x00400000
#define EXPORT_OPTION_NFSV4   0x00800000
#define EXPORT_OPTION_UDP   0x01000000
#define EXPORT_OPTION_TCP   0x02000000
#define EXPORT_OPTION_MAXOFFSETWRITE   0x04000000
#define EXPORT_OPTION_MAXOFFSETREAD   0x08000000
#define EXPORT_OPTION_MAXCACHESIZE   0x10000000
#define EXPORT_OPTION_USE_PNFS   0x20000000
#define EXPORT_OPTION_USE_UQUOTA   0x40000000
#define EXPORT_PERMISSION_GRANTED   0x00000001
#define EXPORT_MDONLY_GRANTED   0x00000002
#define EXPORT_PERMISSION_DENIED   0x00000003
#define EXPORT_WRITE_ATTEMPT_WHEN_RO   0x00000004
#define EXPORT_WRITE_ATTEMPT_WHEN_MDONLY_RO   0x00000005
#define MAX_PSEUDO_ENTRY   100
#define NFS_CLIENT_NAME_LEN   256

Typedefs

typedef struct
exportlist_client_hostif__ 
exportlist_client_hostif_t
typedef struct
exportlist_client_net__ 
exportlist_client_net_t
typedef struct
exportlist_client_netgrp__ 
exportlist_client_netgrp_t
typedef struct
exportlist_client_wildcard_host__ 
exportlist_client_wildcard_host_t
typedef struct
exportlist_client_gss__ 
exportlist_client_gss_t
typedef enum
exportlist_access_type__ 
exportlist_access_type_t
typedef enum
exportlist_client_type__ 
exportlist_client_type_t
typedef enum exportlist_status__ exportlist_status_t
typedef union
exportlist_client_union__ 
exportlist_client_union_t
typedef struct
exportlist_client_entry__ 
exportlist_client_entry_t
typedef struct exportlist_client__ exportlist_client_t
typedef struct exportlist__ exportlist_t
typedef struct pseudofs_entry pseudofs_entry_t
typedef struct pseudofs pseudofs_t
typedef struct
nfs_client_cred_gss__ 
nfs_client_cred_gss_t
typedef struct nfs_client_cred__ nfs_client_cred_t
typedef struct nfs_worker_data__ nfs_worker_data_t
typedef struct nfs41_session__ nfs41_session_t
 NFS v4 Compound Data.
typedef struct nfs_client_id_t nfs_client_id_t
typedef struct
COMPOUND4res_extended 
COMPOUND4res_extended
typedef struct compoud_data compound_data_t
 Compound data.

Enumerations

enum  exportlist_access_type__ { ACCESSTYPE_RW = 1, ACCESSTYPE_RO = 2, ACCESSTYPE_MDONLY = 3, ACCESSTYPE_MDONLY_RO = 4 }
enum  exportlist_client_type__ {
  HOSTIF_CLIENT = 1, NETWORK_CLIENT = 2, NETGROUP_CLIENT = 3, WILDCARDHOST_CLIENT = 4,
  GSSPRINCIPAL_CLIENT = 5, HOSTIF_CLIENT_V6 = 6, BAD_CLIENT = 7
}
enum  exportlist_status__ { EXPORTLIST_OK = 1, EXPORTLIST_UNAVAILABLE = 2 }

Functions

exportlist_tnfs_Get_export_by_id (exportlist_t *exportroot, unsigned short exportid)
int nfs_check_anon (exportlist_client_entry_t *pexport_client, exportlist_t *pexport, struct user_cred *user_credentials)
int nfs_build_fsal_context (struct svc_req *ptr_req, exportlist_t *pexport, fsal_op_context_t *pcontext, struct user_cred *user_credentials)
int get_req_uid_gid (struct svc_req *ptr_req, exportlist_t *pexport, struct user_cred *user_credentials)
int nfs_compare_clientcred (nfs_client_cred_t *pcred1, nfs_client_cred_t *pcred2)
int nfs_rpc_req2client_cred (struct svc_req *reqp, nfs_client_cred_t *pcred)
int nfs_export_check_access (sockaddr_t *hostaddr, struct svc_req *ptr_req, exportlist_t *pexport, unsigned int nfs_prog, unsigned int mnt_prog, hash_table_t *ht_ip_stats, pool_t *ip_stats_pool, exportlist_client_entry_t *pclient_found, struct user_cred *user_credentials, bool_t proc_makes_write)
int nfs_export_check_security (struct svc_req *ptr_req, exportlist_t *pexport)
int nfs_export_tag2path (exportlist_t *exportroot, char *tag, int taglen, char *path, int pathlen)

Detailed Description

Prototypes for what's related to export list management.

Author:
Author:
leibovic
Date:
Date:
2006/01/23 16:15:10
Version:
Revision:
1.32

nfs_exports.h : Prototypes for what's related to export list management.

Definition in file nfs_exports.h.


Define Documentation

#define ANON_GID   -2

Definition at line 67 of file nfs_exports.h.

#define ANON_UID   -2

Definition at line 66 of file nfs_exports.h.

#define EXPORT_KEY_SIZE   8

Definition at line 65 of file nfs_exports.h.

#define EXPORT_LINESIZE   1024

Definition at line 69 of file nfs_exports.h.

#define EXPORT_MDONLY_GRANTED   0x00000002

Definition at line 269 of file nfs_exports.h.

#define EXPORT_OPTION_AUTH_NONE   0x00010000

Definition at line 246 of file nfs_exports.h.

#define EXPORT_OPTION_AUTH_UNIX   0x00020000

Definition at line 247 of file nfs_exports.h.

#define EXPORT_OPTION_GSSPRINC   0x00000080

Definition at line 231 of file nfs_exports.h.

#define EXPORT_OPTION_MAXCACHESIZE   0x10000000

Definition at line 263 of file nfs_exports.h.

#define EXPORT_OPTION_MAXOFFSETREAD   0x08000000

Definition at line 262 of file nfs_exports.h.

#define EXPORT_OPTION_MAXOFFSETWRITE   0x04000000

Definition at line 261 of file nfs_exports.h.

#define EXPORT_OPTION_MAXREAD   0x00000200

Definition at line 233 of file nfs_exports.h.

#define EXPORT_OPTION_MAXWRITE   0x00000400

Definition at line 234 of file nfs_exports.h.

#define EXPORT_OPTION_MD_READ_ACCESS   0x00040000

Definition at line 242 of file nfs_exports.h.

#define EXPORT_OPTION_MD_WRITE_ACCESS   0x00020000

Definition at line 241 of file nfs_exports.h.

#define EXPORT_OPTION_NETENT   0x00000008

Definition at line 227 of file nfs_exports.h.

#define EXPORT_OPTION_NETGRP   0x00000020

Definition at line 229 of file nfs_exports.h.

#define EXPORT_OPTION_NFSV2   0x00200000

Definition at line 254 of file nfs_exports.h.

#define EXPORT_OPTION_NFSV3   0x00400000

Definition at line 255 of file nfs_exports.h.

#define EXPORT_OPTION_NFSV4   0x00800000

Definition at line 256 of file nfs_exports.h.

#define EXPORT_OPTION_NOSGID   0x00000002

Definition at line 225 of file nfs_exports.h.

#define EXPORT_OPTION_NOSUID   0x00000001

Definition at line 224 of file nfs_exports.h.

#define EXPORT_OPTION_PREFRDDIR   0x00002000

Definition at line 237 of file nfs_exports.h.

#define EXPORT_OPTION_PREFREAD   0x00000800

Definition at line 235 of file nfs_exports.h.

#define EXPORT_OPTION_PREFWRITE   0x00001000

Definition at line 236 of file nfs_exports.h.

#define EXPORT_OPTION_PRIVILEGED_PORT   0x00004000

Definition at line 238 of file nfs_exports.h.

#define EXPORT_OPTION_PSEUDO   0x00000100

Definition at line 232 of file nfs_exports.h.

#define EXPORT_OPTION_READ_ACCESS   0x00000010

Definition at line 228 of file nfs_exports.h.

#define EXPORT_OPTION_ROOT   0x00000004

Definition at line 226 of file nfs_exports.h.

#define EXPORT_OPTION_RPCSEC_GSS_INTG   0x00080000

Definition at line 250 of file nfs_exports.h.

#define EXPORT_OPTION_RPCSEC_GSS_NONE   0x00040000

Definition at line 249 of file nfs_exports.h.

#define EXPORT_OPTION_RPCSEC_GSS_PRIV   0x00100000

Definition at line 251 of file nfs_exports.h.

#define EXPORT_OPTION_TCP   0x02000000

Definition at line 258 of file nfs_exports.h.

#define EXPORT_OPTION_UDP   0x01000000

Definition at line 257 of file nfs_exports.h.

#define EXPORT_OPTION_USE_DATACACHE   0x00008000

Definition at line 239 of file nfs_exports.h.

#define EXPORT_OPTION_USE_PNFS   0x20000000

Definition at line 264 of file nfs_exports.h.

#define EXPORT_OPTION_USE_UQUOTA   0x40000000

Definition at line 265 of file nfs_exports.h.

#define EXPORT_OPTION_WILDCARD   0x00000040

Definition at line 230 of file nfs_exports.h.

#define EXPORT_OPTION_WRITE_ACCESS   0x00010000

Definition at line 240 of file nfs_exports.h.

#define EXPORT_PERMISSION_DENIED   0x00000003

Definition at line 270 of file nfs_exports.h.

#define EXPORT_PERMISSION_GRANTED   0x00000001

Definition at line 268 of file nfs_exports.h.

#define EXPORT_WRITE_ATTEMPT_WHEN_MDONLY_RO   0x00000005

Definition at line 272 of file nfs_exports.h.

#define EXPORT_WRITE_ATTEMPT_WHEN_RO   0x00000004

Definition at line 271 of file nfs_exports.h.

#define EXPORTS_NB_MAX_CLIENTS   128

Definition at line 141 of file nfs_exports.h.

#define GSS_DEFINE_LEN_TEMP   255

Definition at line 94 of file nfs_exports.h.

#define INPUT_SIZE   1024

Definition at line 70 of file nfs_exports.h.

#define MAX_PSEUDO_ENTRY   100

Definition at line 292 of file nfs_exports.h.

#define NFS_CLIENT_NAME_LEN   256

Definition at line 300 of file nfs_exports.h.


Typedef Documentation

Definition at line 334 of file nfs_exports.h.

typedef struct compoud_data compound_data_t

Compound data.

This structure contains the necessary stuff for keeping the state of a V4 compound request.

typedef struct exportlist__ exportlist_t

NFS v4 Compound Data.

This structure contains the necessary stuff for keeping the state of a V4 compound request.

Definition at line 332 of file nfs_exports.h.

Definition at line 333 of file nfs_exports.h.

Definition at line 323 of file nfs_exports.h.

typedef struct pseudofs pseudofs_t

Enumeration Type Documentation

Enumerator:
ACCESSTYPE_RW 
ACCESSTYPE_RO 
ACCESSTYPE_MDONLY 
ACCESSTYPE_MDONLY_RO 

Definition at line 100 of file nfs_exports.h.

Enumerator:
HOSTIF_CLIENT 
NETWORK_CLIENT 
NETGROUP_CLIENT 
WILDCARDHOST_CLIENT 
GSSPRINCIPAL_CLIENT 
HOSTIF_CLIENT_V6 
BAD_CLIENT 

Definition at line 109 of file nfs_exports.h.

Enumerator:
EXPORTLIST_OK 
EXPORTLIST_UNAVAILABLE 

Definition at line 120 of file nfs_exports.h.


Function Documentation

int get_req_uid_gid ( struct svc_req *  req,
exportlist_t pexport,
struct user_cred user_credentials 
)

get_req_uid_gid:

Parameters:
req[IN] incoming request.
pexport_client[IN] related export client
pexport[IN] related export entry
user_credentials[OUT] Filled in structure with uid and gids
Returns:
TRUE if successful, FALSE otherwise

Definition at line 162 of file nfs_export_list.c.

int nfs_build_fsal_context ( struct svc_req *  req,
exportlist_t pexport,
fsal_op_context_t pcontext,
struct user_cred user_credentials 
)

nfs_build_fsal_context: Builds the FSAL context according to the request and the export entry.

Builds the FSAL credentials according to the request and the export entry.

Parameters:
req[IN] incoming request.
pexport_client[IN] related export client
pexport[IN] related export entry
pcred[IN/OUT] initialized credential of caller thread.
user_credentials[OUT] Filled in structure with uid and gids
Returns:
TRUE if successful, FALSE otherwise

Definition at line 348 of file nfs_export_list.c.

int nfs_check_anon ( exportlist_client_entry_t pexport_client,
exportlist_t pexport,
struct user_cred user_credentials 
)

Definition at line 308 of file nfs_export_list.c.

int nfs_compare_clientcred ( nfs_client_cred_t pcred1,
nfs_client_cred_t pcred2 
)

nfs_compare_rpc_cred: Compares two RPC creds

Parameters:
pcred1[IN] first RPC cred
pcred2[IN] second RPC cred
Returns:
TRUE if same, FALSE otherwise

Definition at line 409 of file nfs_export_list.c.

int nfs_export_check_access ( sockaddr_t hostaddr,
struct svc_req *  ptr_req,
exportlist_t pexport,
unsigned int  nfs_prog,
unsigned int  mnt_prog,
hash_table_t ht_ip_stats,
pool_t ip_stats_pool,
exportlist_client_entry_t pclient_found,
struct user_cred user_credentials,
bool_t  proc_makes_write 
)

nfs_export_check_access: checks if a machine is authorized to access an export entry.

Checks if a machine is authorized to access an export entry.

Parameters:
ssaddr[IN] the complete remote address (as a sockaddr_storage to be IPv6 compliant)
ptr_req[IN] pointer to the related RPC request.
pexpprt[IN] related export entry (if found, NULL otherwise).
nfs_prog[IN] number for the NFS program.
mnt_program[IN] number for the MOUNT program.
ht_ip_stats[INOUT] IP/stats hash table
ip_stats_pool[INOUT] IP/stats pool
pclient_found[OUT] pointer to client entry found in export list, NULL if nothing was found.
Returns:
EXPORT_PERMISSION_GRANTED on success and EXPORT_PERMISSION_DENIED, EXPORT_WRITE_ATTEMPT_WHEN_RO, or EXPORT_WRITE_ATTEMPT_WHEN_MDONLY_RO on failure.

Definition at line 2650 of file exports.c.

int nfs_export_check_security ( struct svc_req *  req,
exportlist_t pexport 
)

nfs_export_check_security: checks if request security flavor is suffcient for the requested export

Checks if request security flavor is suffcient for the requested export

Parameters:
ptr_req[IN] pointer to the related RPC request.
pexpprt[IN] related export entry (if found, NULL otherwise).
Returns:
TRUE if the request flavor exists in the matching export FALSE otherwise

Definition at line 2528 of file exports.c.

int nfs_export_tag2path ( exportlist_t exportroot,
char *  tag,
int  taglen,
char *  path,
int  pathlen 
)

Definition at line 523 of file nfs_export_list.c.

exportlist_t* nfs_Get_export_by_id ( exportlist_t exportroot,
unsigned short  exportid 
)

nfs_Get_export_by_id: Gets an export entry from its export id.

Gets an export entry from its export id.

exportroot [IN] the root for the export list

Parameters:
exportid[IN] the id for the entry to be found.
Returns:
the pointer to the pointer to the export list or NULL if failed.

Definition at line 128 of file nfs_export_list.c.

int nfs_rpc_req2client_cred ( struct svc_req *  reqp,
nfs_client_cred_t pcred 
)

Definition at line 447 of file nfs_export_list.c.