Skip to content

Commit 8b28fa0

Browse files
Carsten SchaferCarsten Schafer
authored andcommitted
Some more cleanup - remove code using deprecated functions
Signed-off-by: Carsten Schafer <Carsten.Schafer@kinarasystems.com>
1 parent aeef70a commit 8b28fa0

3 files changed

Lines changed: 10 additions & 98 deletions

File tree

src/AP_WS_Connection.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ namespace OpenWifi {
3030
Poco::Logger &L, std::pair<std::shared_ptr<Poco::Net::SocketReactor>, std::shared_ptr<LockedDbSession>> R);
3131
~AP_WS_Connection();
3232

33-
void LogOpenSslErrors();
3433
void EndConnection();
3534
void ProcessJSONRPCEvent(Poco::JSON::Object::Ptr &Doc);
3635
void ProcessJSONRPCResult(Poco::JSON::Object::Ptr Doc);

src/framework/utils.cpp

Lines changed: 7 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -888,99 +888,15 @@ namespace OpenWifi::Utils {
888888
return password;
889889
}
890890

891-
#if 0
892-
/*
893-
Note that this function isn't used. It has been removed due to this deprecation warning:
894-
#47 3.825 /owgw/src/framework/utils.cpp: In function 'std::vector<OpenWifi::Utils::NAPTRRecord> OpenWifi::Utils::getNAPTRRecords(const std::string&)':
891+
/*
892+
Note that these 2 functions aren't used. They have been removed due to this deprecation warning:
893+
// Function to query NAPTR records for a domain and return them in a vector
894+
#47 3.825 /owgw/src/framework/utils.cpp: In function 'std::vector<OpenWifi::Utils::NAPTRRecord> OpenWifi::Utils::getNAPTRRecords(const std::string&)':
895895
#47 3.825 /owgw/src/framework/utils.cpp:915:28: warning: 'int ns_sprintrr(const ns_msg*, const ns_rr*, const char*, const char*, char*, size_t)' is deprecated [-Wdeprecated-declarations]
896-
#47 3.825 915 | ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata));
897-
#47 3.825 | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
898-
#47 3.825 In file included from /usr/include/resolv.h:60,
899-
#47 3.825 from /owgw/src/framework/utils.cpp:17:
900-
#47 3.825 /usr/include/arpa/nameser.h:408:17: note: declared here
901-
#47 3.825 408 | int ns_sprintrr (const ns_msg *, const ns_rr *,
902-
#47 3.825 | ^~~~~~~~~~~
903-
#47 3.833 /owgw/src/framework/utils.cpp: In function 'std::vector<OpenWifi::Utils::SrvRecord> OpenWifi::Utils::getSRVRecords(const std::string&)':
904-
#47 3.833 /owgw/src/framework/utils.cpp:952:28: warning: 'int ns_sprintrr(const ns_msg*, const ns_rr*, const char*, const char*, char*, size_t)' is deprecated [-Wdeprecated-declarations]
905-
#47 3.833 952 | ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata));
906-
#47 3.833 | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
907-
#47 3.833 /usr/include/arpa/nameser.h:408:17: note: declared here
908-
#47 3.833 408 | int ns_sprintrr (const ns_msg *, const ns_rr *,
909-
#47 3.833 | ^~~~~~~~~~~
910-
*/
911-
// Function to query NAPTR records for a domain and return them in a vector
912-
std::vector<NAPTRRecord> getNAPTRRecords(const std::string& domain) {
913-
std::vector<NAPTRRecord> naptrRecords;
914-
915-
unsigned char buf[4096];
916-
ns_msg handle;
917-
ns_initparse(buf, NS_PACKETSZ, &handle);
918-
919-
// Query NAPTR records for the given domain
920-
int response = res_query(domain.c_str(), ns_c_in, ns_t_naptr, buf, sizeof(buf));
921-
if (response < 0) {
922-
return naptrRecords;
923-
}
924-
925-
if(ns_initparse(buf, response, &handle) < 0) {
926-
return naptrRecords;
927-
}
928-
929-
// Iterate through the DNS response and extract NAPTR records
930-
int count = ns_msg_count(handle, ns_s_an);
931-
for (int i = 0; i < count; ++i) {
932-
ns_rr rr;
933-
if (ns_parserr(&handle, ns_s_an, i, &rr) == 0) {
934-
char rdata[256];
935-
ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata));
936-
NAPTRRecord record;
937-
std::istringstream os(rdata);
938-
os >> record.name >> record.ttl >> record.rclass >> record.rtype >> record.order >> record.preference >> record.flags
939-
>> record.service >> record.regexp >> record.replacement;
940-
naptrRecords.push_back(record);
941-
}
942-
}
943-
944-
return naptrRecords;
945-
}
946896
947897
std::vector<SrvRecord> getSRVRecords(const std::string& domain) {
948-
std::vector<SrvRecord> srvRecords;
949-
950-
// Buffer to hold the DNS response
951-
unsigned char buf[4096];
952-
ns_msg handle;
953-
ns_initparse(buf, NS_PACKETSZ, &handle);
954-
955-
// Query NAPTR records for the given domain
956-
int response = res_query(domain.c_str(), ns_c_in, ns_t_srv, buf, sizeof(buf));
957-
if (response < 0) {
958-
std::cerr << "DNS query failed for " << domain << ": " << hstrerror(h_errno) << std::endl;
959-
return srvRecords;
960-
}
961-
962-
if(ns_initparse(buf, response, &handle) < 0) {
963-
return srvRecords;
964-
}
965-
966-
// Iterate through the DNS response and extract NAPTR records
967-
int count = ns_msg_count(handle, ns_s_an);
968-
for (int i = 0; i < count; ++i) {
969-
ns_rr rr;
970-
if (ns_parserr(&handle, ns_s_an, i, &rr) == 0) {
971-
char rdata[256];
972-
ns_sprintrr(&handle, &rr, nullptr, nullptr, rdata, sizeof(rdata));
973-
SrvRecord record;
974-
std::istringstream os(rdata);
975-
os >> record.name >> record.ttl >> record.rclass >> record.rtype >> record.pref >> record.weight >>
976-
record.port >> record.srvname ;
977-
srvRecords.push_back(record);
978-
}
979-
}
980-
981-
return srvRecords;
982-
}
983-
#endif
984-
898+
#47 3.833 /owgw/src/framework/utils.cpp: In function 'std::vector<OpenWifi::Utils::SrvRecord> OpenWifi::Utils::getSRVRecords(const std::string&)':
899+
#47 3.833 /owgw/src/framework/utils.cpp:952:28: warning: 'int ns_sprintrr(const ns_msg*, const ns_rr*, const char*, const char*, char*, size_t)' is deprecated [-Wdeprecated-declarations]
900+
*/
985901

986902
} // namespace OpenWifi::Utils

src/framework/utils.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,10 @@ namespace OpenWifi::Utils {
298298
std::string replacement;
299299
};
300300

301-
#if 0
302301
// removed due to deprecation: see utils.cpp
303302
// Function to query NAPTR records for a domain and return them in a vector
304-
std::vector<NAPTRRecord> getNAPTRRecords(const std::string& domain);
305-
#endif
303+
//std::vector<NAPTRRecord> getNAPTRRecords(const std::string& domain);
304+
306305
struct SrvRecord {
307306
std::string name;
308307
std::string ttl;
@@ -314,10 +313,8 @@ namespace OpenWifi::Utils {
314313
std::string srvname;
315314
};
316315

317-
#if 0
318316
// removed due to deprecation: see utils.cpp
319-
std::vector<SrvRecord> getSRVRecords(const std::string& domain);
320-
#endif
317+
// std::vector<SrvRecord> getSRVRecords(const std::string& domain);
321318

322319
struct HostNameServerResult{
323320
std::string Hostname;

0 commit comments

Comments
 (0)