X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmountd%2Fcache.c;h=6de05f111eb5a76029c831f4a244be4bdb36a32a;hp=457fc9c9d1ac9f7aa42c823504188896c0839686;hb=7df8ca883bfd668eb559ea1b8da7c7b6e41d5b1a;hpb=9fae1474f1f79c2c7f222a40dff6d3d4681a9115 diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index 457fc9c..6de05f1 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -118,7 +118,7 @@ static void auth_unix_ip(FILE *f) } qword_print(f, "nfsd"); qword_print(f, ipaddr); - qword_printuint(f, time(0) + DEFAULT_TTL); + qword_printtimefrom(f, DEFAULT_TTL); if (use_ipaddr) qword_print(f, ipaddr); else if (client) @@ -183,7 +183,7 @@ static void auth_unix_gid(FILE *f) } } qword_printuint(f, uid); - qword_printuint(f, time(0) + DEFAULT_TTL); + qword_printtimefrom(f, DEFAULT_TTL); if (rv >= 0) { qword_printuint(f, ngroups); for (i=0; ie_path) != 0; int flag_mask = different_fs ? ~NFSEXP_FSID : ~0; - qword_printuint(f, time(0) + exp->e_ttl); + qword_printtimefrom(f, exp->e_ttl); qword_printint(f, exp->e_flags & flag_mask); qword_printint(f, exp->e_anonuid); qword_printint(f, exp->e_anongid); @@ -750,7 +750,7 @@ static int dump_to_cache(FILE *f, char *domain, char *path, struct exportent *ex qword_printhex(f, u, 16); } } else - qword_printuint(f, time(0) + DEFAULT_TTL); + qword_printtimefrom(f, DEFAULT_TTL); return qword_eol(f); } @@ -1109,11 +1109,24 @@ static struct exportent *lookup_junction(char *dom, const char *pathname, (void)dlclose(handle); return exp; } + +static void lookup_nonexport(FILE *f, char *dom, char *path, + struct addrinfo *ai) +{ + struct exportent *eep; + + eep = lookup_junction(dom, path, ai); + dump_to_cache(f, dom, path, eep); + if (eep == NULL) + return; + exportent_release(eep); + free(eep); +} #else /* !HAVE_NFS_PLUGIN_H */ -static inline struct exportent *lookup_junction(char *UNUSED(dom), - const char *UNUSED(pathname), struct addrinfo *UNUSED(ai)) +static void lookup_nonexport(FILE *f, char *dom, char *path, + struct addrinfo *UNUSED(ai)) { - return NULL; + dump_to_cache(f, dom, path, NULL); } #endif /* !HAVE_NFS_PLUGIN_H */ @@ -1164,16 +1177,9 @@ static void nfsd_export(FILE *f) " or fsid= required", path); dump_to_cache(f, dom, path, NULL); } - } else { - struct exportent *eep; - - eep = lookup_junction(dom, path, ai); - dump_to_cache(f, dom, path, eep); - if (eep != NULL) { - exportent_release(eep); - free(eep); - } - } + } else + lookup_nonexport(f, dom, path, ai); + out: xlog(D_CALL, "nfsd_export: found %p path %s", found, path ? path : NULL); if (dom) free(dom); @@ -1333,7 +1339,7 @@ int cache_export(nfs_export *exp, char *path) qword_print(f, "nfsd"); qword_print(f, host_ntop(get_addrlist(exp->m_client, 0), buf, sizeof(buf))); - qword_printuint(f, time(0) + exp->m_export.e_ttl); + qword_printtimefrom(f, exp->m_export.e_ttl); qword_print(f, exp->m_client->m_hostname); err = qword_eol(f);