auditd(8): Log a better error when no hostname is set in audit_control

Cherry-pick from https://github.com/openbsm/openbsm/commit/01ba03b

Reviewed by:	cem
Obtained from:	OpenBSM
MFC after:	2 weeks
Pull Request:	https://github.com/openbsm/openbsm/pull/38
This commit is contained in:
asomers 2018-07-22 18:06:42 +00:00
parent 9c190e8f72
commit dd5df8c25b

View File

@ -261,7 +261,8 @@ auditd_set_host(void)
struct auditinfo_addr aia;
int error, ret = ADE_NOERR;
if (getachost(auditd_host, sizeof(auditd_host)) != 0) {
if ((getachost(auditd_host, sizeof(auditd_host)) != 0) ||
((auditd_hostlen = strlen(auditd_host)) == 0)) {
ret = ADE_PARSE;
/*
@ -278,7 +279,6 @@ auditd_set_host(void)
ret = ADE_AUDITON;
return (ret);
}
auditd_hostlen = strlen(auditd_host);
error = getaddrinfo(auditd_host, NULL, NULL, &res);
if (error)
return (ADE_GETADDR);