struct exportent *e = &exp->m_export;
dupexportent(e, nep);
+ if (nep->e_hostname)
+ e->e_hostname = xstrdup(nep->e_hostname);
exp->m_exported = 0;
exp->m_xtabent = 0;
new = (nfs_export *) xmalloc(sizeof(*new));
memcpy(new, exp, sizeof(*new));
dupexportent(&new->m_export, &exp->m_export);
+ if (exp->m_export.e_hostname)
+ new->m_export.e_hostname = xstrdup(exp->m_export.e_hostname);
clp = client_dup(exp->m_client, hp);
clp->m_count++;
new->m_client = clp;
free(exp->m_export.e_mountpoint);
if (exp->m_export.e_fslocdata)
xfree(exp->m_export.e_fslocdata);
+ xfree(exp->m_export.e_hostname);
xfree(exp);
}
exportlist[i] = NULL;
if (!exp2) {
struct exportent ee;
dupexportent(&ee, &exp->m_export);
- strncpy (ee.e_hostname, rep->r_client,
- sizeof (ee.e_hostname) - 1);
- ee.e_hostname[sizeof (ee.e_hostname) -1] = '\0';
+ ee.e_hostname = rep->r_client;
exp2 = export_create(&ee, 0);
exp2->m_changed = exp->m_changed;
}
/* write out the export entry using the FQDN */
xe = exp->m_export;
- strncpy(xe.e_hostname,
- exp->m_client->m_hostname,
- sizeof (xe.e_hostname) - 1);
- xe.e_hostname[sizeof (xe.e_hostname) - 1] = '\0';
+ xe.e_hostname = exp->m_client->m_hostname;
putexportent(&xe);
}
}
return;
setexportent(_PATH_XTAB, "a");
xe = exp->m_export;
- strncpy(xe.e_hostname, exp->m_client->m_hostname,
- sizeof (xe.e_hostname) - 1);
- xe.e_hostname[sizeof (xe.e_hostname) - 1] = '\0';
+ xe.e_hostname = exp->m_client->m_hostname;
putexportent(&xe);
endexportent();
xfunlock(lockid);
* allow overrides when using exportfs.
*/
struct exportent {
- char e_hostname[NFSCLNT_IDMAX+1];
+ char * e_hostname;
char e_path[NFS_MAXPATHLEN+1];
/* The mount path may be different from the exported path due
to submount. It may change for every mount. The idea is we
if (!has_default_opts)
xlog(L_WARNING, "No options for %s %s: suggest %s(sync) to avoid warning", ee.e_path, exp, exp);
}
- if (strlen(hostname) >= sizeof(ee.e_hostname)) {
- syntaxerr("client name too long");
- export_errno = EINVAL;
- return NULL;
- }
- strncpy(ee.e_hostname, hostname, sizeof (ee.e_hostname) - 1);
- ee.e_hostname[sizeof (ee.e_hostname) - 1] = '\0';
+ xfree(ee.e_hostname);
+ ee.e_hostname = xstrdup(hostname);
if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0)
return NULL;
dst->e_mountpoint = strdup(src->e_mountpoint);
if (src->e_fslocdata)
dst->e_fslocdata = strdup(src->e_fslocdata);
+ dst->e_hostname = NULL;
}
struct exportent *
ee.e_nsqgids = 0;
ee.e_uuid = NULL;
- if (strlen(hname) >= sizeof(ee.e_hostname)) {
- xlog(L_WARNING, "client name %s too long", hname);
- return NULL;
- }
- strncpy(ee.e_hostname, hname, sizeof (ee.e_hostname) - 1);
- ee.e_hostname[sizeof (ee.e_hostname) - 1] = '\0';
+ xfree(ee.e_hostname);
+ ee.e_hostname = xstrdup(hname);
+
if (strlen(path) >= sizeof(ee.e_path)) {
xlog(L_WARNING, "path name %s too long", path);
return NULL;