#721 Incorrect return value on failure in resolve_get_domain_send
Closed: Fixed Opened by sgallagh.

A negative return value of "gethostname" is assigned to signed variable "ret".
Function "gethostname(&state->hostname, 64UL)" returns a negative number.
 1170    ret = gethostname(state->hostname, HOST_NAME_MAX);
At conditional (1): "ret" taking the true branch.
 1171    if (ret) {
At conditional (2): "2 <= debug_level" taking the true branch.
At conditional (3): "debug_timestamps" taking the true branch.
"ret" is passed to a parameter that cannot be negative.
 1172        DEBUG(2, ("gethostname() failed: [%d]: %s\n",ret, strerror(ret)));
 1173        return NULL;
 1174    }

We're not reporting the correct return value here if gethostname() fails.

gethostname() returns zero on success, or -1 on error and sets errno. We should be reporting errno in the debug statement here.


Fields changed

milestone: NEEDS_TRIAGE => SSSD 1.5.0

Fixed by

coverity: => 10012
resolution: => fixed
status: new => closed

Fixed by b1df1383dcefa38f9f5d52be3a11e8bb1f465bbf

Fields changed

rhbz: => 0

Metadata Update from @sgallagh:
- Issue assigned to sbose
- Issue set to the milestone: SSSD 1.5.0

SSSD is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in SSSD's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/SSSD/sssd/issues/1763

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata