Get rid of AUTH completely and replace all uses with 'struct AUTH'
parent
9c29b498f4
commit
67ba2239cb
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue