-
Notifications
You must be signed in to change notification settings - Fork 86
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
base: future
Are you sure you want to change the base?
Conversation
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()); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
if (verbose) | ||
LOG(LOG_ERR, "%s: Ber parse error", message); |
There was a problem hiding this comment.
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, ....)
if (verbose) | ||
LOG(LOG_ERR, "%s: not enough byte for length on 2 bytes", message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
if (verbose) | ||
LOG(LOG_ERR, "%s: not enough byte for length on 3 bytes", message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
if (verbose) | ||
LOG(LOG_ERR, "%s: Ber parse error, length=0x%lx", message, length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
if (verbose) | ||
LOG(LOG_ERR, "%s: Ber unexpected tag", message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
BerOID ret = s.in_skip_bytes(bytes).as<std::vector<uint8_t>>(); | ||
return ret; |
There was a problem hiding this comment.
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>();
No description provided.