Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion sample/server.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "server.h"
#include "packet_codes.h"
#include "attribute_types.h"
#include <functional>
#include <iostream>

Expand Down Expand Up @@ -33,7 +34,14 @@ RadProto::Packet Server::makeResponse(const RadProto::Packet& request)
std::vector<uint8_t> vendorValue {0, 0, 0, 3};
vendorSpecific.push_back(RadProto::VendorSpecific(m_dictionaries.vendorCode("Dlink"), m_dictionaries.vendorAttributeCode("Dlink", "Dlink-User-Level"), vendorValue));

if (request.type() == RadProto::ACCESS_REQUEST)
std::string userName;
for (const auto& attribute : request.attributes())
{
if (attribute->type() == RadProto::USER_NAME)
userName = attribute->toString();
}

if (request.type() == RadProto::ACCESS_REQUEST && userName == "test")
return RadProto::Packet(RadProto::ACCESS_ACCEPT, request.id(), request.auth(), attributes, vendorSpecific);

return RadProto::Packet(RadProto::ACCESS_REJECT, request.id(), request.auth(), attributes, vendorSpecific);
Expand Down
2 changes: 1 addition & 1 deletion src/packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
Packet::Packet(uint8_t type, uint8_t id, const std::array<uint8_t, 16>& auth, const std::vector<Attribute*>& attributes, const std::vector<VendorSpecific>& vendorSpecific)
: m_type(type),
m_id(id),
m_recalcAuth(m_type == 2),
m_recalcAuth(m_type == 2 || m_type == 3 || m_type == 11),
m_auth(auth),
m_attributes(attributes),
m_vendorSpecific(vendorSpecific)
Expand Down Expand Up @@ -132,7 +132,7 @@
sendBuffer[i + sendBuffer.size() - secret.length()] = secret[i];

std::array<uint8_t, 16> md;
MD5(sendBuffer.data(), sendBuffer.size(), md.data());

Check warning on line 135 in src/packet.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, llvm-15.0.2, Ninja Multi-Config, Release, ON, ON)

'MD5' is deprecated [-Wdeprecated-declarations]

Check warning on line 135 in src/packet.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, gcc-11, Unix Makefiles, Release, ON, ON)

‘unsigned char* MD5(const unsigned char*, size_t, unsigned char*)’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]

Check warning on line 135 in src/packet.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, llvm-15.0.2, Unix Makefiles, Release, ON, ON)

'MD5' is deprecated [-Wdeprecated-declarations]

Check warning on line 135 in src/packet.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, llvm-15.0.2, Ninja Multi-Config, Debug, ON, ON)

'MD5' is deprecated [-Wdeprecated-declarations]

Check warning on line 135 in src/packet.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, gcc-11, Ninja Multi-Config, Release, ON, ON)

‘unsigned char* MD5(const unsigned char*, size_t, unsigned char*)’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]

Check warning on line 135 in src/packet.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, gcc-11, Ninja Multi-Config, Debug, ON, ON)

‘unsigned char* MD5(const unsigned char*, size_t, unsigned char*)’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]

Check warning on line 135 in src/packet.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, llvm-15.0.2, Unix Makefiles, Debug, ON, ON)

'MD5' is deprecated [-Wdeprecated-declarations]

Check warning on line 135 in src/packet.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, gcc-11, Unix Makefiles, Debug, ON, ON)

‘unsigned char* MD5(const unsigned char*, size_t, unsigned char*)’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]

sendBuffer.resize(sendBuffer.size() - secret.length());

Expand Down
Loading