From 3ce8e360fbc69e9e1d388ae4645ea11a9389909e Mon Sep 17 00:00:00 2001 From: saturneric Date: Sun, 28 Jul 2024 21:46:39 +0200 Subject: [PATCH] fix: remove dependency of assuan --- src/m_pinentry/pinentry.cpp | 45 ------------------------------------- 1 file changed, 45 deletions(-) diff --git a/src/m_pinentry/pinentry.cpp b/src/m_pinentry/pinentry.cpp index 981aee3..072fa6c 100644 --- a/src/m_pinentry/pinentry.cpp +++ b/src/m_pinentry/pinentry.cpp @@ -45,7 +45,6 @@ #include #endif -#include #include #include "pinentry.h" @@ -229,50 +228,6 @@ int pinentry_inq_quality(const QString &passphrase) { return std::max(-100, std::min(100, score)); } -/* Run a genpin inquiry */ -char *pinentry_inq_genpin(pinentry_t pin) { - assuan_context_t ctx = (assuan_context_t)pin->ctx_assuan; - const char prefix[] = "INQUIRE GENPIN"; - char *line; - size_t linelen; - int gotvalue = 0; - char *value = NULL; - int rc; - - if (!ctx) return 0; /* Can't run the callback. */ - - rc = assuan_write_line(ctx, prefix); - if (rc) { - fprintf(stderr, "ASSUAN WRITE LINE failed: rc=%d\n", rc); - return 0; - } - - for (;;) { - do { - rc = assuan_read_line(ctx, &line, &linelen); - if (rc) { - fprintf(stderr, "ASSUAN READ LINE failed: rc=%d\n", rc); - free(value); - return 0; - } - } while (*line == '#' || !linelen); - if (line[0] == 'E' && line[1] == 'N' && line[2] == 'D' && - (!line[3] || line[3] == ' ')) - break; /* END command received*/ - if (line[0] == 'C' && line[1] == 'A' && line[2] == 'N' && - (!line[3] || line[3] == ' ')) - break; /* CAN command received*/ - if (line[0] == 'E' && line[1] == 'R' && line[2] == 'R' && - (!line[3] || line[3] == ' ')) - break; /* ERR command received*/ - if (line[0] != 'D' || line[1] != ' ' || linelen < 3 || gotvalue) continue; - gotvalue = 1; - value = strdup(line + 2); - } - - return value; -} - /* Try to make room for at least LEN bytes in the pinentry. Returns new buffer on success and 0 on failure or when the old buffer is sufficient. */