]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mountd/cache.c
mountd: Ensure cache downcall can handle IPv6 addresses
[nfs-utils.git] / utils / mountd / cache.c
index ab873d56ba4bb37eb36360613e5f5f132a7be26a..f70f4d6e81a7e1ee7b57061f34b7d1c6d68ba162 100644 (file)
@@ -80,7 +80,7 @@ static void auth_unix_ip(FILE *f)
         */
        char *cp;
        char class[20];
-       char ipaddr[20];
+       char ipaddr[INET6_ADDRSTRLEN];
        char *client = NULL;
        struct addrinfo *tmp = NULL;
        struct addrinfo *ai = NULL;
@@ -95,7 +95,7 @@ static void auth_unix_ip(FILE *f)
            strcmp(class, "nfsd") != 0)
                return;
 
-       if (qword_get(&cp, ipaddr, 20) <= 0)
+       if (qword_get(&cp, ipaddr, sizeof(ipaddr)) <= 0)
                return;
 
        tmp = host_pton(ipaddr);
@@ -943,7 +943,7 @@ static int cache_export_ent(char *domain, struct exportent *exp, char *path)
  */
 int cache_export(nfs_export *exp, char *path)
 {
-       char buf[INET_ADDRSTRLEN];
+       char buf[INET6_ADDRSTRLEN];
        int err;
        FILE *f;
 
@@ -953,7 +953,7 @@ int cache_export(nfs_export *exp, char *path)
 
 
        qword_print(f, "nfsd");
-       qword_print(f, 
+       qword_print(f,
                host_ntop(get_addrlist(exp->m_client, 0), buf, sizeof(buf)));
        qword_printint(f, time(0)+30*60);
        qword_print(f, exp->m_client->m_hostname);