1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-19 00:13:33 +00:00

security/0d1n: fix build

- convert static REINPLACE_CMD to patch files as per policy
 - remove remaining <alloca.h> uses
 - patch getopt_long use on targets where char is unsigned
 - work around missing __GNUC_PREREQ macro
 - fix other missing includes
 - update pkg-plist to what the maintainer intended to pack
 - patch /opt/0d1n to ${DATADIR} in the relevant files
 - note that project is dual licensed (upstream has since
   removed the GPLv3 license)
 - define LICENSE_FILE_{GPLv3,BSD3CLAUSE}

PR:		269717
Fixes:		88dd085ff7
Approved by:	portmgr (build fix blanket)
Approved by:	flo (mentor)
Differential Revision: https://reviews.freebsd.org/D38725
This commit is contained in:
Robert Clausecker 2023-02-20 13:46:34 +01:00
parent 117bc95296
commit ffba4d2517
11 changed files with 147 additions and 10 deletions

View File

@ -1,14 +1,16 @@
PORTNAME= 0d1n
PORTVERSION= 3.8
DISTVERSION= 3.8
PORTREVISION= 1
CATEGORIES= security
MAINTAINER= zackj901@yandex.com
COMMENT= Open source web HTTP fuzzing tool and bruteforcer
WWW= https://github.com/CoolerVoid/0d1n
LICENSE= GPLv3
BROKEN= fails to build
LICENSE= BSD3CLAUSE GPLv3
LICENSE_COMB= dual
LICENSE_FILE_BSD3CLAUSE= ${WRKSRC}/LICENSE
LICENSE_FILE_GPLv3= ${WRKSRC}/LICENSE.txt
LIB_DEPENDS= libcurl.so:ftp/curl
@ -16,14 +18,14 @@ USE_GITHUB= yes
GH_ACCOUNT= CoolerVoid
GH_TAGNAME= OdinV38
PLIST_FILES= bin/0d1n
PORTDOCS= README.txt
OPTIONS_DEFINE= DOCS
post-patch:
@${REINPLACE_CMD} -e '/^#include <alloca\.h>/d' \
${WRKSRC}/src/headers/spider.h ${WRKSRC}/src/headers/results.h
pre-configure:
${REINPLACE_CMD} -e 's,/opt/0d1n,${DATADIR},g' \
${WRKSRC}/src/headers/file_ops.h \
${WRKSRC}/src/file_ops.c \
${WRKSRC}/src/opt_extract.c \
${WRKSRC}/src/results.c
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin

View File

@ -0,0 +1,14 @@
--- 0d1n_viewer/lib/krypton/krypton.c.orig 2023-02-20 12:36:21 UTC
+++ 0d1n_viewer/lib/krypton/krypton.c
@@ -112,11 +112,6 @@ typedef struct {
#define NS_INTERNAL
#endif
-/* C99 and later requires alloca.h. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199900L
-#include <alloca.h>
-#endif
-
#include <assert.h>
#include <ctype.h>
#include <errno.h>

View File

@ -0,0 +1,14 @@
--- 0d1n_viewer/lib/krypton/src/ktypes.h.orig 2023-02-20 12:36:40 UTC
+++ 0d1n_viewer/lib/krypton/src/ktypes.h
@@ -18,11 +18,6 @@
#define NS_INTERNAL
#endif
-/* C99 and later requires alloca.h. */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199900L
-#include <alloca.h>
-#endif
-
#include <assert.h>
#include <ctype.h>
#include <errno.h>

View File

@ -0,0 +1,12 @@
--- src/0d1n.c.orig 2023-02-20 12:38:21 UTC
+++ src/0d1n.c
@@ -62,8 +62,7 @@ main (int argc, char ** argv)
/* remove comment to test the patch
*/
#ifdef __GNUC__
-# if __GNUC_PREREQ(10,0)
-
+# if __GNUC__ >= 10
scan_gcc_new();
# else
scan_gcc_old();

View File

@ -0,0 +1,10 @@
--- src/headers/file_ops.h.orig 2023-02-20 12:35:55 UTC
+++ src/headers/file_ops.h
@@ -12,7 +12,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
-#include <alloca.h>
#include "opt_extract.h"
void end_datatable(char * path);

View File

@ -0,0 +1,10 @@
--- src/headers/results.h.orig 2023-02-20 12:35:39 UTC
+++ src/headers/results.h
@@ -4,7 +4,6 @@
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
-#include <alloca.h>
#include <unistd.h>
#include <sys/stat.h>
#include <time.h>

View File

@ -0,0 +1,10 @@
--- src/headers/spider.h.orig 2023-02-20 12:36:07 UTC
+++ src/headers/spider.h
@@ -4,7 +4,6 @@
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
-#include <alloca.h>
#include <unistd.h>
#include <sys/stat.h>
#include <time.h>

View File

@ -0,0 +1,11 @@
--- src/mem_ops.c.orig 2023-02-20 12:57:16 UTC
+++ src/mem_ops.c
@@ -17,7 +17,7 @@ static void *
xmalloc_fatal(size_t size)
{
- DEBUG("\n Memory FAILURE...\n size dbg: %lu\n",size);
+ DEBUG("\n Memory FAILURE...\n size dbg: %zu\n",size);
exit(0);
}

View File

@ -0,0 +1,11 @@
--- src/opt_extract.c.orig 2023-02-20 12:39:15 UTC
+++ src/opt_extract.c
@@ -164,7 +164,7 @@ void
parser_opts (int argc, char **argv)
{
- char c;
+ int c;
static struct option long_options[] =
{

View File

@ -0,0 +1,15 @@
--- src/strsec.c.orig 2023-02-20 12:39:57 UTC
+++ src/strsec.c
@@ -16,11 +16,11 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include "strsec.h"
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && \
!defined(__bsdi__) && !defined(__APPLE__)
-#include "strsec.h"
/*
* Copy src to string dst of size siz. At most siz-1 characters
* will be copied. Always NUL terminates (unless siz == 0).

28
security/0d1n/pkg-plist Normal file
View File

@ -0,0 +1,28 @@
bin/0d1n
%%DATADIR%%/payloads/crlfinjection.txt
%%DATADIR%%/payloads/dir_brute.txt
%%DATADIR%%/payloads/find_responses.txt
%%DATADIR%%/payloads/js_inject.txt
%%DATADIR%%/payloads/ldap_injection.txt
%%DATADIR%%/payloads/list.txt
%%DATADIR%%/payloads/openredirect.txt
%%DATADIR%%/payloads/passive_sqli.txt
%%DATADIR%%/payloads/password_brute.txt
%%DATADIR%%/payloads/path_traversal.txt
%%DATADIR%%/payloads/path_traversal_win32.txt
%%DATADIR%%/payloads/proxy.txt
%%DATADIR%%/payloads/proxy_list.txt
%%DATADIR%%/payloads/sqli.txt
%%DATADIR%%/payloads/useragents.txt
%%DATADIR%%/payloads/wordlist.txt
%%DATADIR%%/payloads/xml_attack.txt
%%DATADIR%%/payloads/xml_attacks.txt
%%DATADIR%%/payloads/xpath_injection.txt
%%DATADIR%%/payloads/xss.txt
%%DATADIR%%/payloads/xss_robertux.txt
%%DATADIR%%/payloads/xxe_fuzz.txt
%%DATADIR%%/templates/hammer1.conf
%%DATADIR%%/templates/hammer2.conf
%%DATADIR%%/templates/template.conf
%%PORTDOCS%%%%DOCSDIR%%/README.txt
@dir %%DATADIR%%/view/response_sources