libnfs_authunix_create: make valgrind happy
[deb_libnfs.git] / lib / libnfs-zdr.c
index e904df9bf356fc28584de07808bc35cc17b15d7f..f5e1a11270291e191d526ce1703e1018061f2567 100644 (file)
  */
 #ifdef WIN32
 #include "win32_compat.h"
-#else
-#include <sys/types.h>
-#include <arpa/inet.h>
-#endif/*WIN32*/
+#endif
+
+#ifdef AROS
+#include "aros_compat.h"
+#endif
 
 #include <stdlib.h>
 #include <string.h>
@@ -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;
@@ -475,10 +476,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));
@@ -505,7 +508,7 @@ struct AUTH *libnfs_authunix_create(char *host, uint32_t uid, uint32_t gid, uint
 struct AUTH *libnfs_authunix_create_default(void)
 {
 #ifdef WIN32
-       return libnfs_authunix_create("libnfs", 65535, 65535, 0, NULL);
+       return libnfs_authunix_create("libnfs", 65534, 65534, 0, NULL);
 #else
        return libnfs_authunix_create("libnfs", getuid(), getgid(), 0, NULL);
 #endif