Skip to content
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

credssp: improve ber parsing/peeking and add support for new messages #121

Open
wants to merge 1 commit into
base: future
Choose a base branch
from

Conversation

hardening
Copy link
Contributor

No description provided.

Comment on lines +150 to +152
this->User.assign(user_utf16_av.data(), user_utf16_av.data()+user_utf16_av.size());
this->Domain.assign(domain_utf16_av.data(), domain_utf16_av.data()+domain_utf16_av.size());
this->Password.assign(password_utf16_av.data(), password_utf16_av.data()+password_utf16_av.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be simplified with

this->User.assign(user_utf16_av.begin(), user_utf16_av.end());

inline std::vector<uint8_t> mkOid(bytes_view oid)
{
std::vector<uint8_t> ret = mkOidHeader(oid.size());
ret << std::vector<uint8_t>(oid.data(), oid.data()+oid.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

<< should take a bytes_view/array_view. I also think <<= to be more explicit than <<.

But is it really better than insert() ?

ret.insert(ret.end(), oid.begin(), oid.end());

backward_push_tagged_field_header(head, oid.size() + head.size(), tag);
std::reverse(head.begin(), head.end());

head << std::vector<uint8_t>(oid.begin(), oid.end());
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Comment on lines +333 to +334
if (verbose)
LOG(LOG_ERR, "%s: Ber parse error", message);
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a macro LOG_IF(verbose, ....)

Comment on lines +344 to +345
if (verbose)
LOG(LOG_ERR, "%s: not enough byte for length on 2 bytes", message);
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Comment on lines +353 to +354
if (verbose)
LOG(LOG_ERR, "%s: not enough byte for length on 3 bytes", message);
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Comment on lines +361 to +362
if (verbose)
LOG(LOG_ERR, "%s: Ber parse error, length=0x%lx", message, length);
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Comment on lines +368 to +370
if (verbose)
LOG(LOG_ERR, "%s: Ber Not enough data for length on %lu bytes(need=%lu have=%lu)",
message, extraSize, extraSize + length, s.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Comment on lines +417 to +418
if (verbose)
LOG(LOG_ERR, "%s: Ber unexpected tag", message);
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Comment on lines +564 to +565
BerOID ret = s.in_skip_bytes(bytes).as<std::vector<uint8_t>>();
return ret;
Copy link
Contributor

Choose a reason for hiding this comment

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

return s.in_skip_bytes(bytes).as<BerOID>();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants