From b961ec7011bb50785dbbc271592b84f3ebae6432 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 5 Sep 2008 05:06:25 +0200 Subject: CertificateRequest angefangen (GSSAPI-Authentifikation) --- src/Common/Request/CertificateRequest.h | 163 +++++++++ src/Common/Request/Makefile.am | 2 +- src/Common/Request/Makefile.in | 2 +- src/Common/Request/Request.h | 4 - src/Core/ConnectionManager.cpp | 3 + src/Core/Makefile.am | 2 + src/Core/Makefile.in | 175 ++++++++-- .../RequestHandler/CertificateRequestHandler.h | 92 +++++ src/Core/RequestHandler/Makefile.am | 1 + src/Core/RequestHandler/Makefile.in | 377 +++++++++++++++++++++ src/Net/ClientConnection.cpp | 1 - src/Net/ServerConnection.cpp | 35 +- src/config.h.in | 6 + src/madc.cpp | 4 +- 14 files changed, 810 insertions(+), 57 deletions(-) create mode 100644 src/Common/Request/CertificateRequest.h create mode 100644 src/Core/RequestHandler/CertificateRequestHandler.h create mode 100644 src/Core/RequestHandler/Makefile.am create mode 100644 src/Core/RequestHandler/Makefile.in (limited to 'src') diff --git a/src/Common/Request/CertificateRequest.h b/src/Common/Request/CertificateRequest.h new file mode 100644 index 0000000..4e26041 --- /dev/null +++ b/src/Common/Request/CertificateRequest.h @@ -0,0 +1,163 @@ +/* + * CertificateRequest.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_COMMON_REQUEST_CERTIFICATEREQUEST_H_ +#define MAD_COMMON_REQUEST_CERTIFICATEREQUEST_H_ + +#include "Request.h" +#include "../RequestManager.h" +#include +#include +#include +#include +#include + +#include + +namespace Mad { +namespace Common { +namespace Request { + + +// TODO Logging & error handling! + +class CertificateRequest : public Request { + private: + std::string serviceName; + gss_name_t gssServiceName; + gss_ctx_id_t gssContext; + + bool gssContinue; + + CertificateRequest(const std::string &serviceName0) : serviceName(serviceName0), gssServiceName(GSS_C_NO_NAME), gssContext(GSS_C_NO_CONTEXT), gssContinue(true) {} + + public: + virtual ~CertificateRequest() { + OM_uint32 minStat; + + if(gssServiceName != GSS_C_NO_NAME) + gss_release_name(&minStat, &gssServiceName); + } + + static bool send(Net::Connection *connection, RequestManager &requestManager, const std::string &serviceName0) { + CertificateRequest *request = new CertificateRequest(serviceName0); + + if(requestManager.sendRequest(connection, request)) + return true; + + delete request; + return false; + } + + virtual bool sendRequest(Net::Connection *connection, unsigned short requestId) { + if(isSent()) + return false; + + OM_uint32 majStat, minStat; + gss_buffer_desc buffer; + + buffer.length = serviceName.length(); + buffer.value = std::malloc(buffer.length); + std::memcpy(buffer.value, serviceName.c_str(), buffer.length); + + majStat = gss_import_name(&minStat, &buffer, GSS_C_NT_HOSTBASED_SERVICE, &gssServiceName); + + std::free(buffer.value); + + if(majStat != GSS_S_COMPLETE) { + gssServiceName = GSS_C_NO_NAME; + return false; + } + + majStat = gss_init_sec_context(&minStat, GSS_C_NO_CREDENTIAL, &gssContext, gssServiceName, GSS_C_NO_OID, GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG, + 0, GSS_C_NO_CHANNEL_BINDINGS, GSS_C_NO_BUFFER, NULL, &buffer, NULL, NULL); + + if(majStat == GSS_S_COMPLETE) { + std::cout << "GSS context established." << std::endl; + gssContinue = false; + } + else if(majStat != GSS_S_CONTINUE_NEEDED) { + gss_release_buffer(&minStat, &buffer); + return false; + } + + if(!connection->send(Net::Packet(Net::Packet::TYPE_CERT_REQ, requestId, buffer.value, buffer.length))) { + gss_release_buffer(&minStat, &buffer); + return false; + } + + gss_release_buffer(&minStat, &buffer); + + setSent(); + return true; + } + + virtual bool handlePacket(Net::Connection *connection, const Net::Packet &packet) { + if(isFinished()) + return false; + + if(packet.getType() != Net::Packet::TYPE_CERT_REP) + return false; // TODO Logging + + OM_uint32 majStat, minStat; + gss_buffer_desc recvBuffer, sendBuffer; + + if(gssContinue) { + recvBuffer.length = packet.getLength(); + recvBuffer.value = std::malloc(recvBuffer.length); + std::memcpy(recvBuffer.value, packet.getData(), recvBuffer.length); + + majStat = gss_init_sec_context(&minStat, GSS_C_NO_CREDENTIAL, &gssContext, gssServiceName, GSS_C_NO_OID, GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG | GSS_C_INTEG_FLAG, + 0, GSS_C_NO_CHANNEL_BINDINGS, &recvBuffer, NULL, &sendBuffer, NULL, NULL); + + std::free(recvBuffer.value); + + if(majStat == GSS_S_COMPLETE) { + std::cout << "GSS context established." << std::endl; + gssContinue = false; + } + else if(majStat != GSS_S_CONTINUE_NEEDED) { + gss_release_buffer(&minStat, &sendBuffer); + return false; + } + + if(!connection->send(Net::Packet(Net::Packet::TYPE_CERT_REQ, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { + gss_release_buffer(&minStat, &sendBuffer); + return false; + } + + gss_release_buffer(&minStat, &sendBuffer); + } + else { + return false; + + //setFinished(); + } + + return true; + } +}; + +} + +} + +} + +#endif /* MAD_COMMON_REQUEST_CERTIFICATEREQUEST_H_ */ diff --git a/src/Common/Request/Makefile.am b/src/Common/Request/Makefile.am index a7de050..6d54206 100644 --- a/src/Common/Request/Makefile.am +++ b/src/Common/Request/Makefile.am @@ -1 +1 @@ -noinst_HEADERS = DisconnectRequest.h IdentifyRequest.h Request.h +noinst_HEADERS = CertificateRequest.h DisconnectRequest.h IdentifyRequest.h Request.h diff --git a/src/Common/Request/Makefile.in b/src/Common/Request/Makefile.in index 9c48118..0b1006d 100644 --- a/src/Common/Request/Makefile.in +++ b/src/Common/Request/Makefile.in @@ -162,7 +162,7 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -noinst_HEADERS = DisconnectRequest.h IdentifyRequest.h Request.h +noinst_HEADERS = CertificateRequest.h DisconnectRequest.h IdentifyRequest.h Request.h all: all-am .SUFFIXES: diff --git a/src/Common/Request/Request.h b/src/Common/Request/Request.h index e0fcf11..e156b1b 100644 --- a/src/Common/Request/Request.h +++ b/src/Common/Request/Request.h @@ -23,9 +23,7 @@ #include "../RequestHandler.h" namespace Mad { - namespace Common { - namespace Request { class Request : public RequestHandler { @@ -44,9 +42,7 @@ class Request : public RequestHandler { }; } - } - } #endif /* MAD_COMMON_REQUEST_REQUEST_H_ */ diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp index 35850c0..b1cfd40 100644 --- a/src/Core/ConnectionManager.cpp +++ b/src/Core/ConnectionManager.cpp @@ -18,6 +18,7 @@ */ #include "ConnectionManager.h" +#include "RequestHandler/CertificateRequestHandler.h" #include #include #include @@ -51,6 +52,8 @@ void ConnectionManager::refreshPollfds() { } ConnectionManager::ConnectionManager(const std::vector &listenerAddresses) : requestManager(true) { + requestManager.registerPacketType(Net::Packet::TYPE_CERT_REQ); + if(listenerAddresses.empty()) { try { listeners.push_back(new Net::Listener()); diff --git a/src/Core/Makefile.am b/src/Core/Makefile.am index 241c030..929003a 100644 --- a/src/Core/Makefile.am +++ b/src/Core/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = RequestHandler + noinst_LTLIBRARIES = libcore.la libcore_la_SOURCES = ConfigManager.cpp ConnectionManager.cpp diff --git a/src/Core/Makefile.in b/src/Core/Makefile.in index 1920fbb..3590c7f 100644 --- a/src/Core/Makefile.in +++ b/src/Core/Makefile.in @@ -61,9 +61,19 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libcore_la_SOURCES) DIST_SOURCES = $(libcore_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive HEADERS = $(noinst_HEADERS) +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) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -179,10 +189,11 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ +SUBDIRS = RequestHandler noinst_LTLIBRARIES = libcore.la libcore_la_SOURCES = ConfigManager.cpp ConnectionManager.cpp noinst_HEADERS = ConfigManager.h ConnectionManager.h -all: all-am +all: all-recursive .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj @@ -263,6 +274,76 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -273,10 +354,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) mkid -fID $$unique tags: TAGS -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ @@ -289,7 +383,7 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$tags $$unique; \ fi ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -336,19 +430,37 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done check-am: all-am -check: check-am +check: check-recursive all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -installcheck: installcheck-am +installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ @@ -364,69 +476,71 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -clean: clean-am +clean: clean-recursive clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am -distclean: distclean-am +distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags -dvi: dvi-am +dvi: dvi-recursive dvi-am: -html: html-am +html: html-recursive -info: info-am +info: info-recursive info-am: install-data-am: -install-dvi: install-dvi-am +install-dvi: install-dvi-recursive install-exec-am: -install-html: install-html-am +install-html: install-html-recursive -install-info: install-info-am +install-info: install-info-recursive install-man: -install-pdf: install-pdf-am +install-pdf: install-pdf-recursive -install-ps: install-ps-am +install-ps: install-ps-recursive installcheck-am: -maintainer-clean: maintainer-clean-am +maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic -mostlyclean: mostlyclean-am +mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool -pdf: pdf-am +pdf: pdf-recursive pdf-am: -ps: ps-am +ps: ps-recursive ps-am: uninstall-am: -.MAKE: install-am install-strip +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + clean-noinstLTLIBRARIES ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ @@ -434,9 +548,10 @@ uninstall-am: install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am # 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/src/Core/RequestHandler/CertificateRequestHandler.h b/src/Core/RequestHandler/CertificateRequestHandler.h new file mode 100644 index 0000000..b524ecd --- /dev/null +++ b/src/Core/RequestHandler/CertificateRequestHandler.h @@ -0,0 +1,92 @@ +/* + * CertificateRequestHandler.h + * + * Copyright (C) 2008 Matthias Schiffer + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef MAD_CORE_REQUESTHANDLER_CERTIFICATEREQUESTHANDLER_H_ +#define MAD_CORE_REQUESTHANDLER_CERTIFICATEREQUESTHANDLER_H_ + +#include +#include +#include +#include + +#include + +namespace Mad { +namespace Core { +namespace RequestHandler { + +class CertificateRequestHandler : public Common::RequestHandler { + private: + gss_ctx_id_t gssContext; + + bool gssContinue; + + public: + CertificateRequestHandler() : gssContext(GSS_C_NO_CONTEXT), gssContinue(true) {} + + virtual bool handlePacket(Net::Connection *connection, const Net::Packet &packet) { + if(isFinished()) + return false; + + if(packet.getType() != Net::Packet::TYPE_CERT_REQ) + return false; // TODO Logging + + OM_uint32 majStat, minStat; + gss_buffer_desc recvBuffer, sendBuffer; + + if(gssContinue) { + recvBuffer.length = packet.getLength(); + recvBuffer.value = std::malloc(recvBuffer.length); + std::memcpy(recvBuffer.value, packet.getData(), recvBuffer.length); + + majStat = gss_accept_sec_context(&minStat, &gssContext, GSS_C_NO_CREDENTIAL, &recvBuffer, GSS_C_NO_CHANNEL_BINDINGS, NULL, NULL, &sendBuffer, NULL, NULL, NULL); + + std::free(recvBuffer.value); + + if(majStat == GSS_S_COMPLETE) { + std::cout << "GSS context established." << std::endl; + gssContinue = false; + } + else if(majStat != GSS_S_CONTINUE_NEEDED) { + gss_release_buffer(&minStat, &sendBuffer); + return false; + } + + if(!connection->send(Net::Packet(Net::Packet::TYPE_CERT_REP, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { + gss_release_buffer(&minStat, &sendBuffer); + return false; + } + + gss_release_buffer(&minStat, &sendBuffer); + } + else { + return false; + + //setFinished(); + } + + return true; + } +}; + +} +} +} + +#endif /* MAD_CORE_REQUESTHANDLER_CERTIFICATEREQUESTHANDLER_H_ */ diff --git a/src/Core/RequestHandler/Makefile.am b/src/Core/RequestHandler/Makefile.am new file mode 100644 index 0000000..c2ff8a1 --- /dev/null +++ b/src/Core/RequestHandler/Makefile.am @@ -0,0 +1 @@ +noinst_HEADERS = CertificateRequestHandler.h diff --git a/src/Core/RequestHandler/Makefile.in b/src/Core/RequestHandler/Makefile.in new file mode 100644 index 0000000..28714f2 --- /dev/null +++ b/src/Core/RequestHandler/Makefile.in @@ -0,0 +1,377 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/Core/RequestHandler +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +GnuTLS_CFLAGS = @GnuTLS_CFLAGS@ +GnuTLS_LIBS = @GnuTLS_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sigc_CFLAGS = @sigc_CFLAGS@ +sigc_LIBS = @sigc_LIBS@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_HEADERS = CertificateRequestHandler.h +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Core/RequestHandler/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Core/RequestHandler/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + +# 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. +.NOEXPORT: diff --git a/src/Net/ClientConnection.cpp b/src/Net/ClientConnection.cpp index a3447a0..8705795 100644 --- a/src/Net/ClientConnection.cpp +++ b/src/Net/ClientConnection.cpp @@ -95,7 +95,6 @@ void ClientConnection::connect(const IPAddress &address, bool daemon0) throw(Con gnutls_credentials_set(session, GNUTLS_CRD_ANON, anoncred); - gnutls_transport_set_lowat(session, 0); gnutls_transport_set_ptr(session, reinterpret_cast(sock)); handshake(); diff --git a/src/Net/ServerConnection.cpp b/src/Net/ServerConnection.cpp index 4f1c78c..c011f66 100644 --- a/src/Net/ServerConnection.cpp +++ b/src/Net/ServerConnection.cpp @@ -31,17 +31,17 @@ void ServerConnection::connectionHeaderReceiveHandler(const void *data, unsigned if(length != sizeof(ConnectionHeader)) // Error... disconnect return; - + const ConnectionHeader *header = reinterpret_cast(data); - + if(header->m != 'M' || header->a != 'A' || header->d != 'D') // Error... disconnect return; - + if(header->protVerMin > 1 || header->protVerMax < 1) // Unsupported protocol... disconnect return; - + if(header->type == 'C') daemon = false; else if(header->type == 'D') @@ -49,37 +49,36 @@ void ServerConnection::connectionHeaderReceiveHandler(const void *data, unsigned else // Error... disconnect return; - + ConnectionHeader header2 = {'M', 'A', 'D', 0, 0, 1, 1, 0}; - + rawSend(reinterpret_cast(&header2), sizeof(header2)); - + enterReceiveLoop(); } ServerConnection::ServerConnection(int sock0, const IPAddress &address, gnutls_dh_params_t dh_params) : daemon(false) { sock = sock0; - + gnutls_anon_allocate_server_credentials(&anoncred); - - + + gnutls_anon_set_server_dh_params(anoncred, dh_params); - + peer = new IPAddress(address); - + gnutls_init(&session, GNUTLS_SERVER); - + gnutls_set_default_priority(session); - + const int kx_list[] = {GNUTLS_KX_ANON_DH, 0}; gnutls_kx_set_priority(session, kx_list); - + gnutls_credentials_set(session, GNUTLS_CRD_ANON, anoncred); - - gnutls_transport_set_lowat(session, 0); + gnutls_transport_set_ptr(session, reinterpret_cast(sock)); - + handshake(); } diff --git a/src/config.h.in b/src/config.h.in index 35132f2..62f49c4 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -9,6 +9,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `gssapi' library (-lgssapi). */ +#undef HAVE_LIBGSSAPI + +/* Define to 1 if you have the `gssapi_krb5' library (-lgssapi_krb5). */ +#undef HAVE_LIBGSSAPI_KRB5 + /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H diff --git a/src/madc.cpp b/src/madc.cpp index 9609e56..e4a36a4 100644 --- a/src/madc.cpp +++ b/src/madc.cpp @@ -21,8 +21,8 @@ #include "Net/IPAddress.h" #include "Net/Packet.h" #include "Common/RequestManager.h" +#include "Common/Request/CertificateRequest.h" #include "Common/Request/DisconnectRequest.h" -#include "Common/Request/IdentifyRequest.h" #include int main() { @@ -43,7 +43,7 @@ int main() { requestManager.registerConnection(connection); - Mad::Common::Request::IdentifyRequest::send(connection, requestManager, "test"); + Mad::Common::Request::CertificateRequest::send(connection, requestManager, "host"); Mad::Common::Request::DisconnectRequest::send(connection, requestManager); while(connection->isConnected()) { -- cgit v1.2.3