Skip to content

snmp: add SHA256 and SHA512 for security protocol #7342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

remicollet
Copy link
Member

#define NETSNMP_USMAUTH_HMAC128SHA224     4 /* RFC 7860; OPTIONAL */
#define NETSNMP_USMAUTH_HMAC192SHA256     5 /* RFC 7860; MUST */
#define NETSNMP_USMAUTH_HMAC256SHA384     6 /* RFC 7860; OPTIONAL */
#define NETSNMP_USMAUTH_HMAC384SHA512     7 /* RFC 7860; SHOULD */

This PR only add recommended protocol (not optional ones, don't think it really make sense to add them)

Copy link
Member

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable, just some style suggestions.

smart_string_appendl(&err, " or \"MD5\"", 9);
#endif
smart_string_0(&err);
zend_value_error("%s", err.c);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd find it more elegant to use smart_str and then do zend_throw_exception_zstr(zend_ce_value_error, err.s, 0) here. No need to go through sprintf if we already have the full message :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not using "%s" raise a security build warning

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[-Werror=format-security]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear, what I had in mind is using an API that uses zend_string (zend_throw_exception_zstr) and thus can just use the string directly. But your current version is okay as well.

@remicollet
Copy link
Member Author

Merged as 718e913
and 5d57d90 (for NEWS)

@remicollet remicollet closed this Aug 11, 2021
@remicollet remicollet deleted the issue-snmp-sha256 branch August 11, 2021 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants