]> the.earth.li Git - onak.git/blobdiff - lookup.c
Add ability to drop overly large packets
[onak.git] / lookup.c
index 9815cbb419922faeec85859b055b57e29720d8d8..c9f94a9e8579c51c187659cecb08f36a742a86a3 100644 (file)
--- a/lookup.c
+++ b/lookup.c
@@ -13,8 +13,7 @@
  * more details.
  *
  * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
 #include <inttypes.h>
@@ -109,7 +108,7 @@ int main(int argc, char *argv[])
 {
        char **params = NULL;
        int op = OP_UNKNOWN;
-       int i;
+       int i, j;
        int indx = 0;
        bool dispfp = false;
        bool skshash = false;
@@ -148,11 +147,11 @@ int main(int argc, char *argv[])
                        if (search != NULL && strlen(search) == 42 &&
                                        search[0] == '0' && search[1] == 'x') {
                                fingerprint.length = MAX_FINGERPRINT_LEN;
-                               for (i = 0; i < MAX_FINGERPRINT_LEN; i++) {
-                                       fingerprint.fp[i] = (hex2bin(
-                                                       search[2 + i * 2])
+                               for (j = 0; j < MAX_FINGERPRINT_LEN; j++) {
+                                       fingerprint.fp[j] = (hex2bin(
+                                                       search[2 + j * 2])
                                                                << 4) +
-                                               hex2bin(search[3 + i * 2]);
+                                               hex2bin(search[3 + j * 2]);
                                }
                                isfp = true;
                        } else if (search != NULL) {
@@ -215,7 +214,7 @@ int main(int argc, char *argv[])
                readconfig(NULL);
                initlogthing("lookup", config.logfile);
                catchsignals();
-               dbctx = config.dbinit(false);
+               dbctx = config.dbinit(config.backend, false);
                switch (op) {
                case OP_GET:
                case OP_HGET:
@@ -240,7 +239,7 @@ int main(int argc, char *argv[])
                                        result,
                                        search);
                                puts("<pre>");
-                               cleankeys(publickey);
+                               cleankeys(&publickey, config.clean_policies);
                                flatten_publickey(publickey,
                                                        &packets,
                                                        &list_end);