X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lib%2Flibnfs-zdr.c;h=0ef4fc02ce00b712535a2d5d266ce374f0d73dc6;hb=b14062764e21e3f03b5d0176f0ac6c127e760012;hp=e439249abb7b67cd506a94960b1cc96e3fc1082b;hpb=10a0ceaaa3e07717a594aa4bae717031e18314aa;p=deb_libnfs.git diff --git a/lib/libnfs-zdr.c b/lib/libnfs-zdr.c index e439249..0ef4fc0 100644 --- a/lib/libnfs-zdr.c +++ b/lib/libnfs-zdr.c @@ -20,9 +20,15 @@ * i.e. zdrmem_create() buffers. * It aims to be compatible with normal rpcgen generated functions. */ +#ifdef WIN32 +#include "win32_compat.h" +#else +#include +#endif/*WIN32*/ #include #include +#include #include "libnfs-zdr.h" struct opaque_auth _null_auth; @@ -160,9 +166,15 @@ bool_t libnfs_zdr_bytes(ZDR *zdrs, char **bufp, uint32_t *size, uint32_t maxsize } -bool_t libnfs_zdr_enum(ZDR *zdrs, int32_t *e) +bool_t libnfs_zdr_enum(ZDR *zdrs, enum_t *e) { - return libnfs_zdr_u_int(zdrs, (uint32_t *)e); + bool_t ret; + int32_t i = *e; + + ret = libnfs_zdr_u_int(zdrs, (uint32_t *)&i); + *e = i; + + return ret; } bool_t libnfs_zdr_bool(ZDR *zdrs, bool_t *b) @@ -286,7 +298,7 @@ static bool_t libnfs_opaque_auth(ZDR *zdrs, struct opaque_auth *auth) return FALSE; } - if (!libnfs_zdr_bytes(zdrs, &auth->oa_base, &auth->oa_length, &auth->oa_length)) { + if (!libnfs_zdr_bytes(zdrs, &auth->oa_base, &auth->oa_length, auth->oa_length)) { return FALSE; } @@ -413,11 +425,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,20 +444,20 @@ 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); - buf = auth->ah_cred.oa_base; + buf = (uint32_t *)auth->ah_cred.oa_base; idx = 0; buf[idx++] = htonl(time(NULL)); buf[idx++] = htonl(strlen(host)); @@ -468,12 +480,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);