From 67ba2239cbbe37413a1eb0a649d780a2a63a3133 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Thu, 5 Jul 2012 10:23:19 +1000 Subject: [PATCH] Get rid of AUTH completely and replace all uses with 'struct AUTH' --- include/libnfs-private.h | 2 +- include/libnfs-raw.h | 2 +- include/libnfs-zdr.h | 12 ++++++------ include/libnfs.h | 3 ++- lib/init.c | 2 +- lib/libnfs-zdr.c | 16 ++++++++-------- lib/libnfs.c | 2 +- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/include/libnfs-private.h b/include/libnfs-private.h index c12d959..f0f8e19 100644 --- a/include/libnfs-private.h +++ b/include/libnfs-private.h @@ -33,7 +33,7 @@ struct rpc_context { rpc_cb connect_cb; void *connect_data; - AUTH *auth; + struct AUTH *auth; unsigned long xid; /* buffer used for encoding RPC PDU */ diff --git a/include/libnfs-raw.h b/include/libnfs-raw.h index 238025d..b227506 100644 --- a/include/libnfs-raw.h +++ b/include/libnfs-raw.h @@ -30,7 +30,7 @@ struct rpc_context; struct rpc_context *rpc_init_context(void); void rpc_destroy_context(struct rpc_context *rpc); -void rpc_set_auth(struct rpc_context *rpc, AUTH *auth); +void rpc_set_auth(struct rpc_context *rpc, struct AUTH *auth); int rpc_get_fd(struct rpc_context *rpc); int rpc_which_events(struct rpc_context *rpc); diff --git a/include/libnfs-zdr.h b/include/libnfs-zdr.h index 660f3b1..4962a4b 100644 --- a/include/libnfs-zdr.h +++ b/include/libnfs-zdr.h @@ -96,11 +96,11 @@ struct opaque_auth { extern struct opaque_auth _null_auth; -typedef struct { +struct AUTH { struct opaque_auth ah_cred; struct opaque_auth ah_verf; caddr_t ah_private; -} AUTH; +}; enum msg_type { CALL=0, @@ -267,15 +267,15 @@ bool_t libnfs_zdr_callmsg(ZDR *zdrs, struct rpc_msg *msg); bool_t libnfs_zdr_replymsg(ZDR *zdrs, struct rpc_msg *msg); #define authnone_create libnfs_authnone_create -AUTH *libnfs_authnone_create(void); +struct AUTH *libnfs_authnone_create(void); #define authunix_create libnfs_authunix_create -AUTH *libnfs_authunix_create(char *host, uint32_t uid, uint32_t gid, uint32_t len, uint32_t *groups); +struct AUTH *libnfs_authunix_create(char *host, uint32_t uid, uint32_t gid, uint32_t len, uint32_t *groups); #define authunix_create_default libnfs_authunix_create_default -AUTH *libnfs_authunix_create_default(void); +struct AUTH *libnfs_authunix_create_default(void); #define auth_destroy libnfs_auth_destroy -void libnfs_auth_destroy(AUTH *auth); +void libnfs_auth_destroy(struct AUTH *auth); #endif diff --git a/include/libnfs.h b/include/libnfs.h index 3d29631..ab2b583 100644 --- a/include/libnfs.h +++ b/include/libnfs.h @@ -62,7 +62,8 @@ EXTERN int nfs_queue_length(struct nfs_context *nfs); /* * Used if you need different credentials than the default for the current user. */ -EXTERN void nfs_set_auth(struct nfs_context *nfs, AUTH *auth); +struct AUTH; +EXTERN void nfs_set_auth(struct nfs_context *nfs, struct AUTH *auth); /* diff --git a/lib/init.c b/lib/init.c index 6bbc11b..936cc8b 100644 --- a/lib/init.c +++ b/lib/init.c @@ -76,7 +76,7 @@ struct rpc_context *rpc_init_udp_context(void) return rpc; } -void rpc_set_auth(struct rpc_context *rpc, AUTH *auth) +void rpc_set_auth(struct rpc_context *rpc, struct AUTH *auth) { if (rpc->auth != NULL) { auth_destroy(rpc->auth); diff --git a/lib/libnfs-zdr.c b/lib/libnfs-zdr.c index 8d43144..fd80a8d 100644 --- a/lib/libnfs-zdr.c +++ b/lib/libnfs-zdr.c @@ -413,11 +413,11 @@ bool_t libnfs_zdr_replymsg(ZDR *zdrs, struct rpc_msg *msg) return libnfs_rpc_msg(zdrs, msg); } -AUTH *authnone_create(void) +struct AUTH *authnone_create(void) { - AUTH *auth; + struct AUTH *auth; - auth = malloc(sizeof(AUTH)); + auth = malloc(sizeof(struct AUTH)); auth->ah_cred.oa_flavor = AUTH_NONE; auth->ah_cred.oa_length = 0; @@ -432,15 +432,15 @@ AUTH *authnone_create(void) return auth; } -AUTH *libnfs_authunix_create(char *host, uint32_t uid, uint32_t gid, uint32_t len, uint32_t *groups) +struct AUTH *libnfs_authunix_create(char *host, uint32_t uid, uint32_t gid, uint32_t len, uint32_t *groups) { - AUTH *auth; + struct AUTH *auth; int size; uint32_t *buf; int idx; size = 4 + 4 + ((strlen(host) + 3) & ~3) + 4 + 4 + 4 + len * 4; - auth = malloc(sizeof(AUTH)); + auth = malloc(sizeof(struct AUTH)); auth->ah_cred.oa_flavor = AUTH_UNIX; auth->ah_cred.oa_length = size; auth->ah_cred.oa_base = malloc(size); @@ -468,12 +468,12 @@ AUTH *libnfs_authunix_create(char *host, uint32_t uid, uint32_t gid, uint32_t le return auth; } -AUTH *libnfs_authunix_create_default(void) +struct AUTH *libnfs_authunix_create_default(void) { return libnfs_authunix_create("libnfs", getuid(), -1, 0, NULL); } -void libnfs_auth_destroy(AUTH *auth) +void libnfs_auth_destroy(struct AUTH *auth) { if (auth->ah_cred.oa_base) { free(auth->ah_cred.oa_base); diff --git a/lib/libnfs.c b/lib/libnfs.c index 5754bfb..c7c9f48 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -113,7 +113,7 @@ struct nfs_mcb_data { static int nfs_lookup_path_async_internal(struct nfs_context *nfs, struct nfs_cb_data *data, struct nfs_fh3 *fh); -void nfs_set_auth(struct nfs_context *nfs, AUTH *auth) +void nfs_set_auth(struct nfs_context *nfs, struct AUTH *auth) { rpc_set_auth(nfs->rpc, auth); } -- 2.34.1