brbzull0 commented on code in PR #8982:
URL: https://github.com/apache/trafficserver/pull/8982#discussion_r931143752
##########
plugins/experimental/maxmind_acl/mmdb.cc:
##########
@@ -497,6 +577,94 @@ Acl::eval(TSRemapRequestInfo *rri, TSHttpTxn txnp)
return ret;
}
+///////////////////////////////////////////////////////////////////////////////
+// Returns true if entry data contains an
+// allowable non-anonymous IP.
+// False otherwise
+bool
+Acl::eval_anonymous(MMDB_entry_s *entry)
+{
+ MMDB_entry_data_s entry_data;
+ int status;
+
+ // For each value we only care if it was successful and if there was data.
+ // We can have unsuccessful gets in the instance an IP is not one of the
things
+ // we are asking for, so its not an error
+ if (_anonymous_ip) {
+ status = MMDB_get_value(entry, &entry_data, "is_anonymous", NULL);
+ if ((MMDB_SUCCESS == status) && (entry_data.has_data)) {
+ if (entry_data.type == MMDB_DATA_TYPE_BOOLEAN) {
+ if (entry_data.boolean == true) {
+ TSDebug(PLUGIN_NAME, "saw is_anonymous set to true bool");
+ return false;
+ }
+ }
+ }
Review Comment:
not an issue.
Maybe you can have an lambda function in here to perform this field get and
call it for every field, code seems similar except for the field name.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]