aboutsummaryrefslogtreecommitdiff
path: root/src/proone-resolv.c
diff options
context:
space:
mode:
authorDavid Timber <mieabby@gmail.com>2021-07-12 16:16:22 +1000
committerDavid Timber <mieabby@gmail.com>2021-07-12 16:16:22 +1000
commit15bde4c46b707f7a95c7ea6650a3f02d67e50530 (patch)
tree1aa069521941a41171302dba837d57d35a2d9e41 /src/proone-resolv.c
parent3fbf08ab6522c91e8209b21d66430a2db4ea71cb (diff)
Impl proone-htbtclient, bugfix, --enable-mttools
* Remove --enable-hostinfod and add --enable-mttools, which enables hostinfod and htbtclient * Change PRNE_HTBT_PROTO_PORT so that the macro can be used in another macro expression(for help message) * Add prne_mbedtls_perror() * proone-htbtclient: implement hostinfo command * proone-htbthost * Add --hostcred option * Response with status frame on ENOMEM * htbt: add prne_htbt_serrc_tostr() and prne_htbt_gen_msgid() * Add prne_ctoupper(), prne_ctolower(), prne_cisspace(), prne_cisprint() * The added functions are the locale-independent equivalent of their POSIX counterparts * Remove Use of the POSIX functions * Add test unit
Diffstat (limited to 'src/proone-resolv.c')
-rw-r--r--src/proone-resolv.c24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/proone-resolv.c b/src/proone-resolv.c
index 0d02b22..d27df4f 100644
--- a/src/proone-resolv.c
+++ b/src/proone-resolv.c
@@ -39,23 +39,6 @@ prne_pth_cv_t prm_cv = { &prm_lock, &prm_cond, false };
prne_resolv_t *resolv = NULL;
-static void upperstr (char *str, const size_t n) {
- for (size_t i = 0; i < n; i += 1) {
- if ('a' <= str[i] && str[i] <= 'z') {
- str[i] -= 'a' - 'A';
- }
- }
-}
-
-static bool printable_str (const char *str, const size_t n) {
- for (size_t i = 0; i < n; i += 1) {
- if (!isprint(str[i])) {
- return false;
- }
- }
- return true;
-}
-
static void proc_prompt_line (char *line, const size_t line_len) {
static regmatch_t rm[3];
@@ -72,7 +55,7 @@ static void proc_prompt_line (char *line, const size_t line_len) {
verb = line + rm[1].rm_so;
verb_len = rm[1].rm_eo - rm[1].rm_so;
- upperstr(verb, verb_len);
+ prne_transcmem(verb, verb_len, prne_ctoupper);
obj = line + rm[2].rm_so;
obj_len = rm[2].rm_eo - rm[2].rm_so;
obj[obj_len] = 0;
@@ -255,9 +238,10 @@ static void *stdout_wkr_entry (void *ctx) {
break;
case PRNE_RESOLV_RTYPE_TXT:
if (isatty(STDOUT_FILENO) &&
- !printable_str(
+ !prne_chkcmem(
(const char *)rr->rd_data + 1,
- rr->rd_data[0]))
+ rr->rd_data[0],
+ prne_cisprint))
{
printf(
";\t\t* (binary data - "