}
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)
}
}
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; i<ngroups; i++)
#define get_uuid_blkdev(path) (NULL)
#endif
-static int get_uuid(const char *val, int uuidlen, char *u)
+static int get_uuid(const char *val, size_t uuidlen, char *u)
{
/* extract hex digits from uuidstr and compose a uuid
* of the given length (max 16), xoring bytes to make
* a smaller uuid.
*/
- int i = 0;
+ size_t i = 0;
memset(u, 0, uuidlen);
for ( ; *val ; val++) {
return 1;
}
-static int uuid_by_path(char *path, int type, int uuidlen, char *uuid)
+static int uuid_by_path(char *path, int type, size_t uuidlen, char *uuid)
{
/* get a uuid for the filesystem found at 'path'.
* There are several possible ways of generating the
{
FILE *f;
struct mntent *me;
- int l = strlen(p);
+ size_t l = strlen(p);
if (*v == NULL) {
f = setmntent("/etc/mtab", "r");
*v = f;
static bool subexport(struct exportent *e1, struct exportent *e2)
{
char *p1 = e1->e_path, *p2 = e2->e_path;
- int l2 = strlen(p2);
+ size_t l2 = strlen(p2);
return e2->e_flags & NFSEXP_CROSSMOUNT
&& strncmp(p1, p2, l2) == 0
unsigned int minor;
unsigned int major;
unsigned int fsidnum;
- int uuidlen;
+ size_t uuidlen;
char *fhuuid;
};
-int parse_fsid(int fsidtype, int fsidlen, char *fsid, struct parsed_fsid *parsed)
+static int parse_fsid(int fsidtype, int fsidlen, char *fsid,
+ struct parsed_fsid *parsed)
{
unsigned int dev;
unsigned long long inode64;
+ memset(parsed, 0, sizeof(*parsed));
parsed->fsidtype = fsidtype;
switch(fsidtype) {
case FSID_DEV: /* 4 bytes: 2 major, 2 minor, 4 inode */
return false;
}
-struct addrinfo *lookup_client_addr(char *dom)
+static struct addrinfo *lookup_client_addr(char *dom)
{
struct addrinfo *ret;
struct addrinfo *tmp;
int different_fs = strcmp(path, exp->e_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);
qword_printhex(f, u, 16);
}
} else
- qword_printuint(f, time(0) + DEFAULT_TTL);
+ qword_printtimefrom(f, DEFAULT_TTL);
return qword_eol(f);
}
static int is_subdirectory(char *child, char *parent)
{
- int l = strlen(parent);
+ size_t l = strlen(parent);
return strcmp(child, parent) == 0
|| (strncmp(child, parent, l) == 0 && child[l] == '/');
(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 */
" 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);
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);