Update with sslsplit develop changes

pull/13/head
Soner Tari 6 years ago
parent e577747ac8
commit 027b6e3a95

@ -42,9 +42,6 @@
# -R ssl2 to get the same result as not building in SSLv2 support at all.
#FEATURES+= -DWITH_SSLV2
# Define to make SSLsplit set a session id context in server mode.
#FEATURES+= -DUSE_SSL_SESSION_ID_CONTEXT
### Debugging
@ -200,36 +197,20 @@ TAR?= tar
### You should not need to touch anything below this line
TARGET:= sslproxy
PNAME:= SSLproxy
PKGLABEL:= SSLproxy
PKGNAME:= sslproxy
TARGET:= $(PKGNAME)
SRCS:= $(filter-out $(wildcard *.t.c),$(wildcard *.c))
HDRS:= $(wildcard *.h)
OBJS:= $(SRCS:.c=.o)
FEATURES:= $(sort $(FEATURES))
TSRCS:= $(wildcard *.t.c)
TOBJS:= $(TSRCS:.t.c=.t.o)
TOBJS+= $(filter-out main.o,$(OBJS))
VFILE:= $(wildcard VERSION)
GITDIR:= $(wildcard .git)
ifdef VFILE
VERSION:= $(shell $(CAT) VERSION)
BUILD_INFO+= V:FILE
else
ifndef GITDIR
VERSION:= $(shell $(BASENAME) $(PWD)|\
$(GREP) $(TARGET)-|\
$(SED) 's/.*$(TARGET)-\(.*\)/\1/g')
NEWSSHA:= $(shell $(OPENSSL) dgst -sha1 -r NEWS.md |\
$(CUT) -c -7)
BUILD_INFO+= V:DIR N:$(NEWSSHA)
else
VERSION:= $(shell $(GIT) describe --tags --dirty --always)
BUILD_INFO+= V:GIT
endif
CFLAGS+= $(DEBUG_CFLAGS)
endif
BUILD_DATE:= $(shell date +%Y-%m-%d)
include Mk/buildinfo.mk
VERSION:= $(BUILD_VERSION)
# Autodetect dependencies known to pkg-config
PKGS:=
@ -341,11 +322,8 @@ TPKG_LIBS+= $(shell $(PKGCONFIG) $(PCFLAGS) --libs-only-l $(TPKGS))
endif
CPPDEFS+= -D_GNU_SOURCE \
-D"BNAME=\"$(TARGET)\"" -D"PNAME=\"$(PNAME)\"" \
-D"VERSION=\"$(VERSION)\"" -D"BUILD_DATE=\"$(BUILD_DATE)\"" \
-D"FEATURES=\"$(FEATURES)\"" -D"BUILD_INFO=\"$(BUILD_INFO)\""
-D"PKGLABEL=\"$(PKGLABEL)\""
CPPCHECKFLAGS+= $(CPPDEFS)
FEATURES:= $(sort $(FEATURES))
ifneq (ccc-analyzer,$(notdir $(CC)))
PKG_CPPFLAGS:= $(subst -I,-isystem,$(PKG_CPPFLAGS))
@ -410,7 +388,8 @@ all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
version.o: version.c version.h GNUmakefile $(VFILE) FORCE
build.o: CPPFLAGS+=$(BUILD_CPPFLAGS)
build.o: build.c FORCE
%.t.o: %.t.c $(HDRS) GNUmakefile
ifdef CHECK_MISSING
@ -475,45 +454,48 @@ mantest: $(TARGET).1
$(MAN) -M . 1 $(TARGET)
$(RM) man1
$(TARGET)-$(VERSION).1.txt: $(TARGET).1
copyright: *.c *.h *.1
Mk/bin/copyright.py $^
$(PKGNAME)-$(VERSION).1.txt: $(TARGET).1
$(RM) -f man1
$(LN) -sf . man1
$(MAN) -M . 1 $(TARGET) | $(COL) -b >$@
$(RM) man1
man: $(TARGET)-$(VERSION).1.txt
man: $(PKGNAME)-$(VERSION).1.txt
manclean:
$(RM) -f $(TARGET)-*.1.txt
$(RM) -f $(PKGNAME)-*.1.txt
fetchdeps:
$(WGET) -O- $(KHASH_URL) >khash.h
#$(RM) -rf xnu/xnu-*
$(MAKE) -C xnu fetch
dist: $(TARGET)-$(VERSION).tar.bz2 $(TARGET)-$(VERSION).tar.bz2.asc
dist: $(PKGNAME)-$(VERSION).tar.bz2 $(PKGNAME)-$(VERSION).tar.bz2.asc
%.asc: %
$(GPG) -u $(GPGSIGNKEY) --armor --output $@ --detach-sig $<
$(TARGET)-$(VERSION).tar.bz2:
$(MKDIR) -p $(TARGET)-$(VERSION)
echo $(VERSION) >$(TARGET)-$(VERSION)/VERSION
$(GIT) archive --prefix=$(TARGET)-$(VERSION)/ HEAD \
>$(TARGET)-$(VERSION).tar
$(TAR) -f $(TARGET)-$(VERSION).tar -r $(TARGET)-$(VERSION)/VERSION
$(BZIP2) <$(TARGET)-$(VERSION).tar >$(TARGET)-$(VERSION).tar.bz2
$(RM) $(TARGET)-$(VERSION).tar
$(RM) -r $(TARGET)-$(VERSION)
disttest: $(TARGET)-$(VERSION).tar.bz2 $(TARGET)-$(VERSION).tar.bz2.asc
$(PKGNAME)-$(VERSION).tar.bz2:
$(MKDIR) -p $(PKGNAME)-$(VERSION)
echo $(VERSION) >$(PKGNAME)-$(VERSION)/VERSION
$(GIT) archive --prefix=$(PKGNAME)-$(VERSION)/ HEAD \
>$(PKGNAME)-$(VERSION).tar
$(TAR) -f $(PKGNAME)-$(VERSION).tar -r $(PKGNAME)-$(VERSION)/VERSION
$(BZIP2) <$(PKGNAME)-$(VERSION).tar >$(PKGNAME)-$(VERSION).tar.bz2
$(RM) $(PKGNAME)-$(VERSION).tar
$(RM) -r $(PKGNAME)-$(VERSION)
disttest: $(PKGNAME)-$(VERSION).tar.bz2 $(PKGNAME)-$(VERSION).tar.bz2.asc
$(GPG) --verify $<.asc $<
$(BZIP2) -d < $< | $(TAR) -x -f -
cd $(TARGET)-$(VERSION) && $(MAKE) && $(MAKE) test && ./$(TARGET) -V
$(RM) -r $(TARGET)-$(VERSION)
cd $(PKGNAME)-$(VERSION) && $(MAKE) && $(MAKE) test && ./$(TARGET) -V
$(RM) -r $(PKGNAME)-$(VERSION)
distclean:
$(RM) -f $(TARGET)-*.tar.bz2*
$(RM) -f $(PKGNAME)-*.tar.bz2*
realclean: distclean manclean clean
$(MAKE) -C extra/pki clean
@ -521,6 +503,6 @@ endif
FORCE:
.PHONY: all config clean test travis lint install deinstall manlint \
.PHONY: all config clean test travis lint install deinstall copyright manlint \
mantest man manclean fetchdeps dist disttest distclean realclean

@ -0,0 +1,67 @@
#!/usr/bin/env python3
# vim: set ft=python list et ts=8 sts=4 sw=4:
import sys
import os
def commentline(prefix, line):
if len(line) > 0:
return prefix + ' ' + line + '\n'
return prefix + '\n'
def license(outfile, filetype):
with open('LICENSE', 'r') as f:
# skip title
f.readline()
f.readline()
text = f.read()
text = ('SSLsplit - transparent SSL/TLS interception\n'
'https://www.roe.ch/SSLsplit\n\n') + text.replace(
'and contributors', '<daniel@roe.ch>')
lines = text.splitlines()
if filetype == 'c':
outfile.write('/*-\n')
for line in lines:
outfile.write(commentline(' *', line))
elif filetype == 'script':
outfile.write('#-\n')
for line in lines:
outfile.write(commentline('#', line))
elif filetype == 'man':
outfile.write('.\\"-\n')
for line in lines:
outfile.write(commentline('.\\"', line))
else:
raise RuntimeError()
def mangle(outfile, infile):
have_first = False
have_header = False
for line in infile:
if have_header:
outfile.write(line)
elif have_first:
if (filetype == 'c' and line.startswith(' */')) or \
(filetype == 'script' and not line.startswith('#')) or \
(filetype == 'man' and not line.startswith('.\\"')):
outfile.write(line)
have_header = True
else:
if line.startswith('/*-'):
filetype = 'c'
elif line.startswith('#-'):
filetype = 'script'
elif line.startswith('.\\"-'):
filetype = 'man'
else:
outfile.write(line)
continue
license(outfile, filetype)
have_first = True
for fn in sys.argv[1:]:
with open(fn, 'r') as infile:
with open(fn + '~', 'w') as outfile:
mangle(outfile, infile)
os.rename(fn + '~', fn)

@ -0,0 +1,54 @@
# in: PKGNAME
# in: FEATURES (optional)
# in: BUILD_INFO (optional)
ifndef PKGNAME
$(error PKGNAME not defined)
endif
BASENAME?= basename
CUT?= cut
GIT?= git
GREP?= grep
OPENSSL?= openssl
SED?= sed
GITDIR:= $(wildcard .git)
VERSION_FILE:= $(wildcard VERSION)
NEWS_FILE:= $(firstword $(wildcard NEWS*))
ifdef GITDIR
BUILD_VERSION:= $(shell $(GIT) describe --tags --dirty --always)
BUILD_INFO+= V:GIT
GITDIR:=
else
ifdef VERSION_FILE
BUILD_VERSION:= $(shell $(CAT) VERSION)
BUILD_INFO+= V:FILE
else
BUILD_VERSION:= $(shell $(BASENAME) $(PWD)|\
$(GREP) $(PKGNAME)-|\
$(SED) 's/.*$(PKGNAME)-\(.*\)/\1/g')
BUILD_INFO+= V:DIR
endif
ifdef NEWS_FILE
NEWS_SHA:= $(shell $(OPENSSL) dgst -sha1 -r $(NEWS_FILE) |\
$(CUT) -c -7)
BUILD_INFO+= N:$(NEWS_SHA)
endif
endif # GITDIR
BUILD_DATE:= $(shell date +%Y-%m-%d)
BUILD_CPPFLAGS+=-D"BUILD_PKGNAME=\"$(PKGNAME)\"" \
-D"BUILD_VERSION=\"$(BUILD_VERSION)\"" \
-D"BUILD_DATE=\"$(BUILD_DATE)\"" \
-D"BUILD_INFO=\"$(BUILD_INFO)\"" \
-D"BUILD_FEATURES=\"$(FEATURES)\""
# out: NEWS_FILE
# out: NEWS_SHA
# out: VERSION_FILE
# out: BUILD_VERSION
# out: BUILD_DATE
# out: BUILD_INFO
# out: BUILD_CPPFLAGS

@ -1,6 +1,7 @@
### SSLsplit develop
- Fix build with OpenSSL 1.1.1 (pull req #186 by @sonertari, issue #183).
- Fix build on FreeBSD 12 (patch-proc.c r436571 from FreeBSD ports).
- Minor bugfixes and improvements.

@ -26,15 +26,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "version.h"
#include "build.h"
/*
* Volatile build-time information which can change between make runs.
*/
const char *version = VERSION;
const char *build_date = BUILD_DATE;
const char *build_info = BUILD_INFO;
const char *features = FEATURES;
const char *build_pkgname = BUILD_PKGNAME;
const char *build_version = BUILD_VERSION;
const char *build_date = BUILD_DATE;
const char *build_info = BUILD_INFO;
const char *build_features = BUILD_FEATURES;
/* vim: set noet ft=c: */

@ -26,14 +26,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef VERSION_H
#define VERSION_H
#ifndef BUILD_H
#define BUILD_H
extern const char *version;
extern const char *build_pkgname;
extern const char *build_version;
extern const char *build_date;
extern const char *build_info;
extern const char *features;
extern const char *build_features;
#endif /* !VERSION_H */
#endif /* !BUILD_H */
/* vim: set noet ft=c: */

@ -40,7 +40,7 @@
#include "cachemgr.h"
#include "sys.h"
#include "log.h"
#include "version.h"
#include "build.h"
#include "defaults.h"
#include <stdlib.h>
@ -71,8 +71,9 @@ int descriptor_table_size = 0;
static void
main_version(void)
{
fprintf(stderr, "%s %s (built %s)\n", PNAME, version, build_date);
if (strlen(version) < 5) {
fprintf(stderr, "%s %s (built %s)\n",
PKGLABEL, build_version, build_date);
if (strlen(build_version) < 5) {
/*
* Note to package maintainers: If you break the version
* string in your build, it will be impossible to provide
@ -103,8 +104,8 @@ main_version(void)
if (build_info[0]) {
fprintf(stderr, "Build info: %s\n", build_info);
}
if (features[0]) {
fprintf(stderr, "Features: %s\n", features);
if (build_features[0]) {
fprintf(stderr, "Features: %s\n", build_features);
}
nat_version();
fprintf(stderr, "Local process info support: ");
@ -217,7 +218,7 @@ main_usage(void)
warn = "";
}
fprintf(stderr, usagefmt, BNAME, dflt, BNAME, warn);
fprintf(stderr, usagefmt, build_pkgname, dflt, build_pkgname, warn);
}
/*

@ -28,7 +28,7 @@
#include "attrib.h"
#include "opts.h"
#include "version.h"
#include "build.h"
#include <stdlib.h>
#include <string.h>

@ -1008,7 +1008,7 @@ ssl_x509_forge(X509 *cacrt, EVP_PKEY *cakey, X509 *origcrt, EVP_PKEY *key,
}
}
#ifdef DEBUG_CERTIFICATE
ssl_x509_v3ext_add(&ctx, crt, "nsComment", "Generated by " PNAME);
ssl_x509_v3ext_add(&ctx, crt, "nsComment", "Generated by " PKGLABEL);
#endif /* DEBUG_CERTIFICATE */
const EVP_MD *md;

@ -42,7 +42,7 @@
#include <check.h>
#define TARGETDIR "extra/pki/targets"
static char template[] = "/tmp/" BNAME ".test.XXXXXX";
static char template[] = "/tmp/sslsplit.test.XXXXXX";
static char *basedir;
static char *file, *lfile, *dir, *ldir, *notexist;

Loading…
Cancel
Save