mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Easier to use ipa_gethostfqdn()
ipa_gethostfqdn() now returns a pointer to a statically allocated buffer or NULL in case of an error. The caller no longer has to supply a correctly allocated buffer. Rename IPA_HOST_HOST to_LEN IPA_HOST_FQDN_LEN and use IPA_HOST_FQDN_LEN wherever code copies a hostname supplied from ipa_gethostfqdn(). Clarify that MAXHOSTNAMELEN and MAXHOSTFQDNLEN are different things. Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
This commit is contained in:
committed by
Fraser Tweedale
parent
3d796a7e51
commit
727a2ffb93
@@ -1445,7 +1445,6 @@ main(int argc, const char **argv) {
|
||||
static const char *keytab = NULL;
|
||||
static const char *bindpw = NULL;
|
||||
static const char *basedn = NULL;
|
||||
char fqdn[IPA_HOST_NAME_LEN];
|
||||
int quiet = 0;
|
||||
int unenroll = 0;
|
||||
int force = 0;
|
||||
@@ -1498,12 +1497,12 @@ main(int argc, const char **argv) {
|
||||
|
||||
/* auto-detect and verify hostname */
|
||||
if (!hostname) {
|
||||
if (ipa_gethostname(fqdn) != 0) {
|
||||
hostname = ipa_gethostfqdn();
|
||||
if (hostname == NULL) {
|
||||
if (!quiet)
|
||||
fprintf(stderr, _("Cannot get host's FQDN!\n"));
|
||||
exit(22);
|
||||
}
|
||||
hostname = fqdn;
|
||||
}
|
||||
if (NULL == strstr(hostname, ".")) {
|
||||
if (!quiet) {
|
||||
|
||||
Reference in New Issue
Block a user