Fix incorrect logging in krb5_parse_name() error handling #156
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Svace static analysis tool identified a potential issue in the function
ngx_http_auth_spnego_basic()
, where the variablecode
might incorrectly store the value fromkrb5_init_context()
instead of the return value fromkrb5_parse_name()
, which causes incorrect error logging. In the current situation, line 922logs the value of
code
, which was previously set bykrb5_init_context()
, instead of the expected return value fromkrb5_parse_name()
Moreover,
krb5_parse_name()
returns a value of typekrb5_error_code
, whilekret
does not match this data type and is not used elsewhere in file. Keeping the variablekret
may be unnecessary. Instead, the return value ofkrb5_parse_name()
should be directly assigned tocode
To resolve this issue,
kret
should be removed, andcode
should be used to store the return value ofkrb5_parse_name()
to ensure correct error logging: