X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lib%2Flibnfs-zdr.c;h=7539b08d7ccf7776a3f0f6cc52391e5f760ed62d;hb=8907aea9ebe4aaad7c5bbd5e6ee45374202d08c6;hp=24bf6c2bc38cf9d73d1cf24095e731794f32d534;hpb=d7c6e9aaa9df593e951e2f19106dcc71102e74f1;p=deb_libnfs.git diff --git a/lib/libnfs-zdr.c b/lib/libnfs-zdr.c index 24bf6c2..7539b08 100644 --- a/lib/libnfs-zdr.c +++ b/lib/libnfs-zdr.c @@ -22,10 +22,11 @@ */ #ifdef WIN32 #include "win32_compat.h" -#else -#include -#include -#endif/*WIN32*/ +#endif + +#ifdef AROS +#include "aros_compat.h" +#endif #include #include @@ -123,7 +124,7 @@ bool_t libnfs_zdr_u_quad_t(ZDR *zdrs, uint64_t *u) *u = ntohl(*(uint32_t *)&zdrs->buf[zdrs->pos]); zdrs->pos += 4; *u <<= 32; - *u |= ntohl(*(uint32_t *)&zdrs->buf[zdrs->pos]); + *u |= (uint32_t)ntohl(*(uint32_t *)&zdrs->buf[zdrs->pos]); zdrs->pos += 4; return TRUE; break; @@ -218,6 +219,9 @@ bool_t libnfs_zdr_opaque(ZDR *zdrs, char *objp, uint32_t size) case ZDR_ENCODE: memcpy(&zdrs->buf[zdrs->pos], objp, size); zdrs->pos += size; + if (zdrs->pos & 3) { + memset(&zdrs->buf[zdrs->pos], 0x00, 4 - (zdrs->pos & 3)); + } zdrs->pos = (zdrs->pos + 3) & ~3; return TRUE; case ZDR_DECODE: @@ -475,10 +479,12 @@ struct AUTH *libnfs_authunix_create(char *host, uint32_t uid, uint32_t gid, uint size = 4 + 4 + ((strlen(host) + 3) & ~3) + 4 + 4 + 4 + len * 4; auth = malloc(sizeof(struct AUTH)); + memset(auth, 0x00, sizeof(struct AUTH)); auth->ah_cred.oa_flavor = AUTH_UNIX; auth->ah_cred.oa_length = size; auth->ah_cred.oa_base = malloc(size); + memset(auth->ah_cred.oa_base, 0x00, size); buf = (uint32_t *)auth->ah_cred.oa_base; idx = 0; buf[idx++] = htonl(time(NULL)); @@ -504,7 +510,11 @@ struct AUTH *libnfs_authunix_create(char *host, uint32_t uid, uint32_t gid, uint struct AUTH *libnfs_authunix_create_default(void) { - return libnfs_authunix_create("libnfs", getuid(), -1, 0, NULL); +#ifdef WIN32 + return libnfs_authunix_create("libnfs", 65534, 65534, 0, NULL); +#else + return libnfs_authunix_create("libnfs", getuid(), getgid(), 0, NULL); +#endif } void libnfs_auth_destroy(struct AUTH *auth)