commit:     d77e62554036e350d01a639f8a3980f8bb4e8a58
Author:     Michael Mair-Keimberger <m.mairkeimberger <AT> gmail <DOT> com>
AuthorDate: Thu Feb  6 16:03:08 2020 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Fri Feb  7 14:18:05 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d77e6255

net-analyzer/authforce: fix for bug 706830 and minor improvements

Signed-off-by: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail.com>
Closes: https://bugs.gentoo.org/706830
Closes: https://github.com/gentoo/gentoo/pull/14582
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 net-analyzer/authforce/authforce-0.9.9-r3.ebuild   |  47 +++++++++
 ...e-0.9.9-fix-parsing-of-sample-config-file.patch |  54 ++++++++++
 ....9.9-fix-submit_dummy_list-re-declaration.patch |  25 +++++
 .../authforce-0.9.9-fixes-for-Wall-warnings.patch  | 111 +++++++++++++++++++++
 4 files changed, 237 insertions(+)

diff --git a/net-analyzer/authforce/authforce-0.9.9-r3.ebuild 
b/net-analyzer/authforce/authforce-0.9.9-r3.ebuild
new file mode 100644
index 00000000000..183912b43ca
--- /dev/null
+++ b/net-analyzer/authforce/authforce-0.9.9-r3.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="An HTTP authentication brute forcer"
+HOMEPAGE="http://www.divineinvasion.net/authforce/";
+SRC_URI="http://www.divineinvasion.net/${PN}/${P}.tar.gz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="curl nls"
+
+RDEPEND="sys-libs/readline:0=
+       curl? ( net-misc/curl )"
+DEPEND="${RDEPEND}"
+BDEPEND="nls? ( sys-devel/gettext )"
+
+DOCS=( AUTHORS BUGS NEWS README THANKS TODO )
+
+PATCHES=(
+       "${FILESDIR}"/${P}-curl.patch
+       "${FILESDIR}"/${P}-locale.patch
+       "${FILESDIR}"/${P}-fixes-for-Wall-warnings.patch
+       "${FILESDIR}"/${P}-fix-parsing-of-sample-config-file.patch
+       "${FILESDIR}"/${P}-fix-submit_dummy_list-re-declaration.patch
+)
+
+src_prepare() {
+       default
+       gunzip doc/${PN}.1.gz
+       sed -i -e "s/${PN}.1.gz/${PN}.1/g" \
+               -e "s/\/mang/\/man1/g" doc/Makefile* || die
+}
+
+src_configure() {
+       econf \
+               $(use_with curl) \
+               $(use_enable nls) \
+               --with-path=/usr/share/${PN}/data:.
+}
+
+src_install() {
+       default
+       doman doc/${PN}.1
+}

diff --git 
a/net-analyzer/authforce/files/authforce-0.9.9-fix-parsing-of-sample-config-file.patch
 
b/net-analyzer/authforce/files/authforce-0.9.9-fix-parsing-of-sample-config-file.patch
new file mode 100644
index 00000000000..902b2a086e0
--- /dev/null
+++ 
b/net-analyzer/authforce/files/authforce-0.9.9-fix-parsing-of-sample-config-file.patch
@@ -0,0 +1,54 @@
+From 294ef3529016c29769d10dee9e5f639c2ce02b91 Mon Sep 17 00:00:00 2001
+From: "Zachary P. Landau" <[email protected]>
+Date: Wed, 5 Feb 2020 23:18:31 -0800
+Subject: [PATCH 3/4] Fix parsing of sample config file
+
+This code is horribly broken, but we should at least be able to parse
+the authforcerc.sample file, and report the right line number when
+failing.
+---
+ src/config.c | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/src/config.c b/src/config.c
+index 4462fcc..66313d9 100644
+--- a/src/config.c
++++ b/src/config.c
+@@ -11,7 +11,7 @@
+ #endif /* MEMWATCH */
+ #include "extern.h"
+ 
+-#define BUFFER_LEN 82
++#define BUFFER_LEN 100
+ #define IS_BIT(x) (!strcmp(x, "0") || !strcmp(x, "1"))
+ 
+ static void process_boolean(char *option, char *value, int *variable) {
+@@ -30,7 +30,7 @@ void parse_config(char *config) {
+       char *option;                                                           
/* config file option */
+       char *value;                                                            
/* value for option */
+ 
+-      int line_number = 1;
++      int line_number = 0;
+       char *chop;
+ 
+       /* MEMWATCH: reports this isnt freed, why? */
+@@ -45,6 +45,7 @@ void parse_config(char *config) {
+       }
+ 
+       while (fgets(buffer, sizeof(buffer), fp)) {
++              line_number++;
+               if (buffer[0] == '#' || buffer[0] == ';' || buffer[0] == '\n')
+                       continue;
+               remove_crud(buffer);
+@@ -123,8 +124,6 @@ void parse_config(char *config) {
+               else
+               if (!quiet)
+                       printf("parse_config: option %s is not valid\n", 
option);
+-
+-              line_number++;
+       }
+ 
+       debug(3, "parse_config: read %s [%i]\n", config, line_number-1);
+-- 
+2.25.0
+

diff --git 
a/net-analyzer/authforce/files/authforce-0.9.9-fix-submit_dummy_list-re-declaration.patch
 
b/net-analyzer/authforce/files/authforce-0.9.9-fix-submit_dummy_list-re-declaration.patch
new file mode 100644
index 00000000000..e6ca243fcad
--- /dev/null
+++ 
b/net-analyzer/authforce/files/authforce-0.9.9-fix-submit_dummy_list-re-declaration.patch
@@ -0,0 +1,25 @@
+From d7f718e78444acef635acdd19e34dc4783e741fa Mon Sep 17 00:00:00 2001
+From: "Zachary P. Landau" <[email protected]>
+Date: Wed, 5 Feb 2020 23:00:06 -0800
+Subject: [PATCH 1/4] Fix submit_dummy_list re-declaration
+
+---
+ src/extern.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/extern.h b/src/extern.h
+index 6798bd7..cc08e0a 100644
+--- a/src/extern.h
++++ b/src/extern.h
+@@ -61,7 +61,7 @@ extern void initialize_submit(void);
+ extern int submit(char *username, char *password);
+ extern void shutdown_submit(void);
+ #ifdef USE_DUMMY
+-char **submit_dummy_list;
++extern char **submit_dummy_list;
+ #endif /* USE_DUMMY */
+ 
+ /* files.c */
+-- 
+2.25.0
+

diff --git 
a/net-analyzer/authforce/files/authforce-0.9.9-fixes-for-Wall-warnings.patch 
b/net-analyzer/authforce/files/authforce-0.9.9-fixes-for-Wall-warnings.patch
new file mode 100644
index 00000000000..083bb93d129
--- /dev/null
+++ b/net-analyzer/authforce/files/authforce-0.9.9-fixes-for-Wall-warnings.patch
@@ -0,0 +1,111 @@
+From ef74da31208f1390bbc17d4c455c821f141ec78b Mon Sep 17 00:00:00 2001
+From: "Zachary P. Landau" <[email protected]>
+Date: Wed, 5 Feb 2020 23:17:50 -0800
+Subject: [PATCH 2/4] Fixes for -Wall warnings
+
+---
+ src/files.c   | 10 +++++-----
+ src/http.c    |  4 ----
+ src/methods.c |  4 ++--
+ 3 files changed, 7 insertions(+), 11 deletions(-)
+
+diff --git a/src/files.c b/src/files.c
+index 1068616..92d45ac 100644
+--- a/src/files.c
++++ b/src/files.c
+@@ -70,7 +70,7 @@ char **textlist(char *textfile) {
+ 
+       /* MEMWATCH: this isnt freed, why? */
+       wordlist[count] = malloc_w(sizeof(NULL));
+-      wordlist[count] = (char)NULL;
++      wordlist[count] = NULL;
+ 
+       fclose(fp);
+ 
+@@ -83,7 +83,7 @@ char **copy_list(char **list) {
+       char **n_list; /* new list */
+ 
+       /* find num of elements */
+-      while (list[i] != (char)NULL) 
++      while (list[i] != NULL)
+               i++;
+       /* plus one for NULL */
+       i++;
+@@ -91,12 +91,12 @@ char **copy_list(char **list) {
+       n_list = malloc_w(i*sizeof(char*));
+ 
+       i=0;
+-      while (list[i] != (char)NULL) {
++      while (list[i] != NULL) {
+               n_list[i] = (char*)strdup_w(list[i]);
+               i++;
+       }
+ 
+-      n_list[i] = (char)NULL;
++      n_list[i] = NULL;
+ 
+       return (n_list);
+ }
+@@ -104,7 +104,7 @@ char **copy_list(char **list) {
+ void free_list(char **list) {
+       int i=0;
+ 
+-      while (list[i] != (char)NULL) {
++      while (list[i] != NULL) {
+               free(list[i]);
+               i++;
+       }
+diff --git a/src/http.c b/src/http.c
+index 88acdfc..397ac1f 100644
+--- a/src/http.c
++++ b/src/http.c
+@@ -40,7 +40,6 @@ int submit(char *username, char *password) {
+       CURLcode result;
+       char error[CURL_ERROR_SIZE] = "";
+       char authstring[92];
+-      time_t before, after;
+ 
+       
+       num_connects++;
+@@ -59,8 +58,6 @@ int submit(char *username, char *password) {
+       } else
+               printf("trying %s->%s\n", username, password);
+ 
+-      before = time(0);
+-
+       if (curl) {
+               curl_easy_setopt(curl, CURLOPT_URL, url);
+               curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error);
+@@ -79,7 +76,6 @@ int submit(char *username, char *password) {
+               result = curl_easy_perform(curl);
+       }
+ 
+-      after = time(0);
+       /* num_connects jumps the gun earlier on */
+ //    acs = stats(acs, after-before, num_connects-1);
+ 
+diff --git a/src/methods.c b/src/methods.c
+index 3c74c65..bdb6efc 100644
+--- a/src/methods.c
++++ b/src/methods.c
+@@ -76,7 +76,7 @@ char *transform(char *username, char *password) {
+ 
+       strncpy(old_password, password, sizeof(char)*41);
+ 
+-      while ((cur_element = elements[i]) != (char)NULL) {
++      while ((cur_element = elements[i]) != NULL) {
+               if (!strcmp(password, "{username}"))
+                       strncpy(insertion, username, sizeof(insertion));
+               else if (!strcmp(password, "{emanresu}"))
+@@ -120,7 +120,7 @@ void common_pairs(void) {
+       }
+ 
+       while (1) {
+-              if (common_pairs_list[i] == (char)NULL)
++              if (common_pairs_list[i] == NULL)
+                       break;
+               strncpy(username, common_pairs_list[i], sizeof(char)*81);
+               password = extract(username, ':');
+-- 
+2.25.0
+

Reply via email to