1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-11 07:22:22 +00:00

Support STAGEDIR.

PR:		ports/193169
Submitted by:	Ports Fury.
This commit is contained in:
Vanilla I. Shu 2014-09-03 02:54:49 +00:00
parent e50aee042b
commit db2f2b85a5
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=367144
7 changed files with 247 additions and 30 deletions

View File

@ -5,8 +5,7 @@ PORTNAME= hydra
PORTVERSION= 0.1.8
PORTREVISION= 9
CATEGORIES= www
MASTER_SITES= http://mirror.inerd.com/FreeBSD/distfiles/${PORTNAME}/ \
ftp://ftp.hellug.gr/pub/software/hydra/
MASTER_SITES= http://hydra.hellug.gr/download/
PKGNAMESUFFIX= -web
MAINTAINER= ports@FreeBSD.org
@ -14,38 +13,41 @@ COMMENT= High performance multi-threaded web server
LIB_DEPENDS= libgnutls.so:${PORTSDIR}/security/gnutls
USES= perl5 pkgconfig shebangfix
SHEBANG_FILES= src/webindex.pl
USE_RC_SUBR= hydra
CONFLICTS_INSTALL= hydra-[0-9]*
USE_PERL5= run
GNU_CONFIGURE= yes
CPPFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib
CFLAGS+= -DENABLE_SSL -DHAVE_LIBGNUTLS
CPPFLAGS+= $$(pkg-config --cflags gnutls)
LDFLAGS+= $$(pkg-config --libs gnutls)
PLIST_SUB= LOGDIR="${LOGDIR}"
SUB_FILES= pkg-deinstall
SUB_LIST= LOGDIR="${LOGDIR}"
CONFLICTS_INSTALL= hydra-[0-9]*
LOGDIR?= /var/log/hydra
SUB_FILES= pkg-deinstall
PLIST_SUB= LOGDIR=${LOGDIR}
SUB_LIST= LOGDIR=${LOGDIR}
NO_STAGE= yes
post-patch:
@${REINPLACE_CMD} -e \
'/LDFLAGS/s| -g"|"|' ${WRKSRC}/configure
.for f in src/defines.h examples/hydra.conf
@${REINPLACE_CMD} -e "s,%%PREFIX%%,${PREFIX},g" \
-e "s,%%LOGDIR%%,${LOGDIR},g" \
-e "s,%%WWWOWN%%,${WWWOWN},g" \
-e "s,%%WWWGRP%%,${WWWGRP},g" \
${WRKSRC}/${f}
@${REINPLACE_CMD} -e \
's|%%PREFIX%%|${PREFIX}|g ; \
s|%%LOGDIR%%|${LOGDIR}|g ; \
s|%%WWWOWN%%|${WWWOWN}|g ; \
s|%%WWWGRP%%|${WWWGRP}|g' ${WRKSRC}/${f}
.endfor
post-install:
@${MKDIR} ${PREFIX}/etc/hydra
@${MKDIR} ${STAGEDIR}${ETCDIR}
.for f in hydra.conf mime.types
${INSTALL_DATA} ${WRKSRC}/examples/${f} ${PREFIX}/etc/hydra/${f}-dist
[ -f ${PREFIX}/etc/hydra/${f} ] || \
${INSTALL_DATA} ${WRKSRC}/examples/${f} ${PREFIX}/etc/hydra/
(cd ${WRKSRC}/examples && ${INSTALL_DATA} ${f} \
${STAGEDIR}${ETCDIR}/${f}.sample)
.endfor
[ -d ${LOGDIR} ] || \
( ${MKDIR} ${LOGDIR} && ${CHOWN} ${WWWOWN}:${WWWGRP} ${LOGDIR} )
.include <bsd.port.mk>

View File

@ -9,3 +9,25 @@
#ifdef ENABLE_SSL
extern int ssl_verify;
@@ -44,7 +44,7 @@
# define GNUTLS_MAX_SESSION_ID 32
#endif
char session_id[GNUTLS_MAX_SESSION_ID];
- int session_id_length = sizeof(session_id);
+ size_t session_id_length = sizeof(session_id);
int i, ret;
char str_session_id[(GNUTLS_MAX_SESSION_ID * 2) + 1];
size_t size;
@@ -128,10 +128,10 @@
}
{
- const gnutls_datum *cert_list;
+ const gnutls_datum_t *cert_list;
char buf[512];
int cert_list_size, ret;
- gnutls_x509_crt crt;
+ gnutls_x509_crt_t crt;
buf[0] = 0;

View File

@ -0,0 +1,11 @@
--- src/globals.h.orig
+++ src/globals.h
@@ -103,7 +103,7 @@
int pollfd_id;
#endif
#ifdef ENABLE_SSL
- gnutls_session ssl_state;
+ gnutls_session_t ssl_state;
char * certificate_verified; /* a string that describes the output of the
* certificate verification function. Needed
* in CGIs.

View File

@ -0,0 +1,20 @@
--- src/request.c.orig
+++ src/request.c
@@ -133,7 +133,7 @@
int len;
static int sockbufsize = SOCKETBUF_SIZE;
#ifdef ENABLE_SSL
- gnutls_session ssl_state = NULL;
+ gnutls_session_t ssl_state = NULL;
#endif
remote_addr.S_FAMILY = 0xdead;
@@ -194,7 +194,7 @@
return;
}
- gnutls_transport_set_ptr(ssl_state, (gnutls_transport_ptr)fd);
+ gnutls_transport_set_ptr(ssl_state, (gnutls_transport_ptr_t)fd);
}
#endif

View File

@ -0,0 +1,148 @@
--- src/ssl.c.orig
+++ src/ssl.c
@@ -29,10 +29,7 @@
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
-#include <gcrypt.h>
#ifdef ENABLE_SMP
-GCRY_THREAD_OPTION_PTHREAD_IMPL;
-
pthread_mutex_t ssl_session_cache_lock = PTHREAD_MUTEX_INITIALIZER;
#endif
@@ -51,12 +48,12 @@
*/
static void wrap_db_init(void);
-static int wrap_db_store(void *dbf, gnutls_datum key, gnutls_datum data);
-static gnutls_datum wrap_db_fetch(void *dbf, gnutls_datum key);
-static int wrap_db_delete(void *dbf, gnutls_datum key);
+static int wrap_db_store(void *dbf, gnutls_datum_t key, gnutls_datum_t data);
+static gnutls_datum_t wrap_db_fetch(void *dbf, gnutls_datum_t key);
+static int wrap_db_delete(void *dbf, gnutls_datum_t key);
static int cur = 0; /* points to the credentials structure used */
-static gnutls_certificate_credentials credentials[2] = { NULL, NULL };
+static gnutls_certificate_credentials_t credentials[2] = { NULL, NULL };
static int need_dh_params = 0; /* whether we need to generate DHE
* parameters. Depend on the chosen ciphersuites.
@@ -69,10 +66,10 @@
*/
extern int ssl_dh_bits;
-gnutls_dh_params _dh_params[2];
-gnutls_rsa_params _rsa_params[2];
+gnutls_dh_params_t _dh_params[2];
+gnutls_rsa_params_t _rsa_params[2];
-static int generate_dh_primes( gnutls_dh_params* dh_params)
+static int generate_dh_primes( gnutls_dh_params_t* dh_params)
{
if (gnutls_dh_params_init( dh_params) < 0) {
log_error_time();
@@ -101,7 +98,7 @@
return 0;
}
-static int generate_rsa_params( gnutls_rsa_params* rsa_params)
+static int generate_rsa_params( gnutls_rsa_params_t* rsa_params)
{
if (gnutls_rsa_params_init( rsa_params) < 0) {
log_error_time();
@@ -165,9 +162,9 @@
/* Initializes a single SSL/TLS session. That is set the algorithm,
* the db backend, whether to request certificates etc.
*/
-gnutls_session initialize_ssl_session(void)
+gnutls_session_t initialize_ssl_session(void)
{
- gnutls_session state;
+ gnutls_session_t state;
gnutls_init(&state, GNUTLS_SERVER);
@@ -215,9 +212,6 @@
log_error_time();
fprintf(stderr, "tls: Initializing GnuTLS/%s.\n", gnutls_check_version(NULL));
-#ifdef ENABLE_SMP
- gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
-#endif
gnutls_global_init();
if (gnutls_certificate_allocate_credentials( &credentials[0]) < 0) {
@@ -294,8 +288,6 @@
comp_priority[i++] = GNUTLS_COMP_NULL;
if ( parse_cs_string( ssl_comp, "ZLIB") != 0)
comp_priority[i++] = GNUTLS_COMP_ZLIB;
- if ( parse_cs_string( ssl_comp, "LZO") != 0)
- comp_priority[i++] = GNUTLS_COMP_LZO;
comp_priority[i] = 0;
/* Add protocols
@@ -416,7 +408,7 @@
cache_db = calloc(1, ssl_session_cache * sizeof(CACHE));
}
-static int wrap_db_store(void *dbf, gnutls_datum key, gnutls_datum data)
+static int wrap_db_store(void *dbf, gnutls_datum_t key, gnutls_datum_t data)
{
if (cache_db == NULL)
@@ -447,9 +439,9 @@
return 0;
}
-static gnutls_datum wrap_db_fetch(void *dbf, gnutls_datum key)
+static gnutls_datum_t wrap_db_fetch(void *dbf, gnutls_datum_t key)
{
- gnutls_datum res = { NULL, 0 };
+ gnutls_datum_t res = { NULL, 0 };
int i;
if (cache_db == NULL)
@@ -489,7 +481,7 @@
return res;
}
-static int wrap_db_delete(void *dbf, gnutls_datum key)
+static int wrap_db_delete(void *dbf, gnutls_datum_t key)
{
int i;
@@ -567,11 +559,11 @@
if (ssl_verify >= 1) {
size_t size;
- int verify, ret, valid;
+ int ret, valid;
char name[128];
- const gnutls_datum *cert_list;
- int cert_list_size;
- gnutls_x509_crt crt = NULL;
+ const gnutls_datum_t *cert_list;
+ unsigned int cert_list_size, verify;
+ gnutls_x509_crt_t crt = NULL;
ret = gnutls_x509_crt_init( &crt);
if (ret < 0) {
@@ -601,7 +593,7 @@
}
- verify = gnutls_certificate_verify_peers( current->ssl_state);
+ gnutls_certificate_verify_peers2( current->ssl_state, &verify);
current->certificate_verified = "NONE";
if (cert_list == NULL) {
@@ -737,8 +729,6 @@
comp_priority[i++] = GNUTLS_COMP_NULL;
if ( parse_cs_string( ssl_comp, "ZLIB") != 0)
comp_priority[i++] = GNUTLS_COMP_ZLIB;
- if ( parse_cs_string( ssl_comp, "LZO") != 0)
- comp_priority[i++] = GNUTLS_COMP_LZO;
comp_priority[i] = 0;
/* Add protocols

View File

@ -0,0 +1,17 @@
--- src/ssl.h.orig
+++ src/ssl.h
@@ -1,12 +1,12 @@
#ifdef ENABLE_SSL
-gnutls_session initialize_ssl_session(void);
+gnutls_session_t initialize_ssl_session(void);
void check_ssl_alert( request* req, int ret);
int send_alert(request * current);
int finish_handshake(request * current);
void ssl_regenerate_params(void);
void generate_x509_dn(char *buf, int sizeof_buf,
- const gnutls_datum * cert, int issuer);
+ const gnutls_datum_t * cert, int issuer);
#endif

View File

@ -1,10 +1,7 @@
bin/hydra
bin/boa_indexer
bin/hydra
bin/webindex.pl
@unexec if cmp -s %D/etc/hydra/hydra.conf %D/etc/hydra/hydra.conf-dist; then rm -f %D/etc/hydra/hydra.conf; fi
etc/hydra/hydra.conf-dist
@exec [ -f %B/hydra.conf ] || cp %B/%f %B/hydra.conf
@unexec if cmp -s %D/etc/hydra/mime.types %D/etc/hydra/mime.types-dist; then rm -f %D/etc/hydra/mime.types; fi
etc/hydra/mime.types-dist
@exec [ -f %B/mime.types ] || cp %B/%f %B/mime.types
@unexec rmdir %D/etc/hydra 2> /dev/null || echo "Dont forget to remove %D/etc/hydra if you won't use hydra anymore"
@sample %%ETCDIR%%/hydra.conf.sample
@sample %%ETCDIR%%/mime.types.sample
@dirrmtry %%ETCDIR%%
@exec install -d -o www -g www %%LOGDIR%%