diff options
Diffstat (limited to 'src/providers/ldap/sdap_access.c')
-rw-r--r-- | src/providers/ldap/sdap_access.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/providers/ldap/sdap_access.c b/src/providers/ldap/sdap_access.c index 4e1709028..486a08c85 100644 --- a/src/providers/ldap/sdap_access.c +++ b/src/providers/ldap/sdap_access.c @@ -1067,7 +1067,7 @@ static errno_t sdap_access_host(struct ldb_message *user_entry) struct ldb_message_element *el; unsigned int i; char *host; - char hostname[HOST_NAME_MAX+1]; + char hostname[HOST_NAME_MAX + 1]; el = ldb_msg_find_element(user_entry, SYSDB_AUTHORIZED_HOST); if (!el || el->num_values == 0) { @@ -1075,11 +1075,12 @@ static errno_t sdap_access_host(struct ldb_message *user_entry) return ERR_ACCESS_DENIED; } - if (gethostname(hostname, sizeof(hostname)) == -1) { + if (gethostname(hostname, HOST_NAME_MAX) == -1) { DEBUG(SSSDBG_CRIT_FAILURE, "Unable to get system hostname. Access denied\n"); return ERR_ACCESS_DENIED; } + hostname[HOST_NAME_MAX] = '\0'; /* FIXME: PADL's pam_ldap also calls gethostbyname() on the hostname * in some attempt to get aliases and/or FQDN for the machine. |