[Pkg-privacy-commits] [onioncat] 91/340: improved peer identification (check tor_prefix of 1st packet)
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:04:28 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch debian
in repository onioncat.
commit 0bc699b581b87155ae1ebfda8f70e84b5b442c94
Author: eagle <eagle at 58e1ccc2-750e-0410-8d0d-f93ca75ab447>
Date: Tue Dec 9 10:36:53 2008 +0000
improved peer identification (check tor_prefix of 1st packet)
git-svn-id: http://www.cypherpunk.at/svn/onioncat/trunk@382 58e1ccc2-750e-0410-8d0d-f93ca75ab447
---
Makefile.am | 4 +--
Makefile.in | 80 ++++++++++-----------------------------------------------
configure | 3 ++-
configure.ac | 2 +-
src/ocatroute.c | 31 ++++++++++++++++++++--
5 files changed, 48 insertions(+), 72 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 779a5ba..8d5eee9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = src
+SUBDIRS = src man
+DIST_SUBDIRS = src man
dist_doc_DATA = README
-man_MANS = man/man1/ocat.1
diff --git a/Makefile.in b/Makefile.in
index b8bc33e..7fa909b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -53,23 +53,19 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
-man1dir = $(mandir)/man1
-am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)"
-NROFF = nroff
-MANS = $(man_MANS)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(docdir)"
dist_docDATA_INSTALL = $(INSTALL_DATA)
DATA = $(dist_doc_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -162,9 +158,9 @@ sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = src
+SUBDIRS = src man
+DIST_SUBDIRS = src man
dist_doc_DATA = README
-man_MANS = man/man1/ocat.1
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -219,51 +215,6 @@ $(srcdir)/config.h.in: $(am__configure_deps)
distclean-hdr:
-rm -f config.h stamp-h1
-install-man1: $(man1_MANS) $(man_MANS)
- @$(NORMAL_INSTALL)
- test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
- @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
- l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
- for i in $$l2; do \
- case "$$i" in \
- *.1*) list="$$list $$i" ;; \
- esac; \
- done; \
- for i in $$list; do \
- if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
- else file=$$i; fi; \
- ext=`echo $$i | sed -e 's/^.*\\.//'`; \
- case "$$ext" in \
- 1*) ;; \
- *) ext='1' ;; \
- esac; \
- inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
- inst=`echo $$inst | sed -e 's/^.*\///'`; \
- inst=`echo $$inst | sed '$(transform)'`.$$ext; \
- echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
- $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
- done
-uninstall-man1:
- @$(NORMAL_UNINSTALL)
- @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
- l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
- for i in $$l2; do \
- case "$$i" in \
- *.1*) list="$$list $$i" ;; \
- esac; \
- done; \
- for i in $$list; do \
- ext=`echo $$i | sed -e 's/^.*\\.//'`; \
- case "$$ext" in \
- 1*) ;; \
- *) ext='1' ;; \
- esac; \
- inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
- inst=`echo $$inst | sed -e 's/^.*\///'`; \
- inst=`echo $$inst | sed '$(transform)'`.$$ext; \
- echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
- rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
- done
install-dist_docDATA: $(dist_doc_DATA)
@$(NORMAL_INSTALL)
test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)"
@@ -562,10 +513,10 @@ distcleancheck: distclean
exit 1; } >&2
check-am: all-am
check: check-recursive
-all-am: Makefile $(MANS) $(DATA) config.h
+all-am: Makefile $(DATA) config.h
installdirs: installdirs-recursive
installdirs-am:
- for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)"; do \
+ for dir in "$(DESTDIR)$(docdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
@@ -611,7 +562,7 @@ info: info-recursive
info-am:
-install-data-am: install-dist_docDATA install-man
+install-data-am: install-dist_docDATA
install-dvi: install-dvi-recursive
@@ -621,7 +572,7 @@ install-html: install-html-recursive
install-info: install-info-recursive
-install-man: install-man1
+install-man:
install-pdf: install-pdf-recursive
@@ -647,9 +598,7 @@ ps: ps-recursive
ps-am:
-uninstall-am: uninstall-dist_docDATA uninstall-man
-
-uninstall-man: uninstall-man1
+uninstall-am: uninstall-dist_docDATA
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
@@ -663,13 +612,12 @@ uninstall-man: uninstall-man1
info-am install install-am install-data install-data-am \
install-dist_docDATA install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-man1 install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs installdirs-am \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am uninstall-dist_docDATA uninstall-man \
- uninstall-man1
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-dist_docDATA
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/configure b/configure
index 123c595..71c207c 100755
--- a/configure
+++ b/configure
@@ -4042,7 +4042,7 @@ fi
done
-ac_config_files="$ac_config_files Makefile src/Makefile"
+ac_config_files="$ac_config_files Makefile src/Makefile man/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -4625,6 +4625,7 @@ do
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
diff --git a/configure.ac b/configure.ac
index 250c113..616e6fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,6 +119,6 @@ AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
#AC_CHECK_FUNCS([clock_gettime memset select socket strchr strerror])
AC_CHECK_FUNCS([strlcat strlcpy])
-AC_CONFIG_FILES([Makefile src/Makefile])
+AC_CONFIG_FILES([Makefile src/Makefile man/Makefile])
AC_OUTPUT
diff --git a/src/ocatroute.c b/src/ocatroute.c
index f546fe5..c5b8e39 100644
--- a/src/ocatroute.c
+++ b/src/ocatroute.c
@@ -265,6 +265,25 @@ int handle_http(const OcatPeer_t *peer)
#endif
+int set_peer_dest(struct in6_addr *dest, const struct in6_addr *addr)
+{
+ if (!has_tor_prefix(addr))
+ {
+ log_debug("remote address does not have OC prefix");
+ return -1;
+ }
+
+ if (IN6_ARE_ADDR_EQUAL(addr, &CNF(ocat_addr)))
+ {
+ log_debug("source address is local address");
+ return -1;
+ }
+
+ *dest = *addr;
+ return 0;
+}
+
+
void *socket_receiver(void *p)
{
int maxfd, len;
@@ -448,7 +467,11 @@ void *socket_receiver(void *p)
if (IN6_IS_ADDR_UNSPECIFIED(&peer->addr))
{
if (*peer->tunhdr == CNF(fhd_key[IPV6_KEY]))
- memcpy(&peer->addr, &((struct ip6_hdr*)peer->fragbuf)->ip6_src, sizeof(struct in6_addr));
+ {
+ //memcpy(&peer->addr, &((struct ip6_hdr*)peer->fragbuf)->ip6_src, sizeof(struct in6_addr));
+ if (set_peer_dest(&peer->addr, &((struct ip6_hdr*)peer->fragbuf)->ip6_src))
+ drop = 1;
+ }
else if (*peer->tunhdr == CNF(fhd_key[IPV4_KEY]))
{
// check if there is a route back
@@ -462,7 +485,11 @@ void *socket_receiver(void *p)
log_debug("no route back");
}
else
- memcpy(&peer->addr, in6, sizeof(struct in6_addr));
+ {
+ //memcpy(&peer->addr, in6, sizeof(struct in6_addr));
+ if (set_peer_dest(&peer->addr, in6))
+ drop = 1;
+ }
}
if (!drop)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onioncat.git
More information about the Pkg-privacy-commits
mailing list