summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2015-04-22 13:33:09 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2015-04-22 13:33:09 +0200
commitdec1359e90e847c90629e43ef3744539e8fb41c8 (patch)
treeda2d2ea07745c4eff127e4c62113e5f197dbc8c1
parentd6e6f65a1cf8723a398689b549dd970121655053 (diff)
downloadaCms-dec1359e90e847c90629e43ef3744539e8fb41c8.tar.gz
aCms-dec1359e90e847c90629e43ef3744539e8fb41c8.tar.bz2
added base64 coding/decoding libary
showing captcha in login page (not verifying yet)
-rw-r--r--3rdParty/CMakeLists.txt1
-rw-r--r--3rdParty/libb64/AUTHORS7
-rw-r--r--3rdParty/libb64/BENCHMARKS85
-rw-r--r--3rdParty/libb64/CHANGELOG25
-rw-r--r--3rdParty/libb64/INSTALL44
-rw-r--r--3rdParty/libb64/LICENSE29
-rw-r--r--3rdParty/libb64/Makefile.orig25
-rw-r--r--3rdParty/libb64/README138
-rw-r--r--3rdParty/libb64/TODO0
-rw-r--r--3rdParty/libb64/base64/Makefile56
-rw-r--r--3rdParty/libb64/base64/VisualStudioProject/Makefile11
-rw-r--r--3rdParty/libb64/base64/VisualStudioProject/base64.sln20
-rw-r--r--3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj92
-rw-r--r--3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj.filters36
-rw-r--r--3rdParty/libb64/base64/base64.cc94
-rw-r--r--3rdParty/libb64/include/b64/cdecode.h28
-rw-r--r--3rdParty/libb64/include/b64/cencode.h31
-rw-r--r--3rdParty/libb64/include/b64/decode.h70
-rw-r--r--3rdParty/libb64/include/b64/encode.h77
-rw-r--r--3rdParty/libb64/src/Makefile43
-rw-r--r--3rdParty/libb64/src/cdecode.c88
-rw-r--r--3rdParty/libb64/src/cencode.c109
-rw-r--r--CMakeLists.txt11
-rw-r--r--src/base64.cpp0
-rw-r--r--src/base64.hpp4
-rw-r--r--src/user.cpp34
-rw-r--r--src/user_content.hpp3
-rw-r--r--templates/login.tmpl3
-rw-r--r--templates/master.tmpl1
29 files changed, 1160 insertions, 5 deletions
diff --git a/3rdParty/CMakeLists.txt b/3rdParty/CMakeLists.txt
index 55b2953..4b7aa4c 100644
--- a/3rdParty/CMakeLists.txt
+++ b/3rdParty/CMakeLists.txt
@@ -1,3 +1,4 @@
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
add_subdirectory(captcha)
+add_subdirectory(libb64)
diff --git a/3rdParty/libb64/AUTHORS b/3rdParty/libb64/AUTHORS
new file mode 100644
index 0000000..af68737
--- /dev/null
+++ b/3rdParty/libb64/AUTHORS
@@ -0,0 +1,7 @@
+libb64: Base64 Encoding/Decoding Routines
+======================================
+
+Authors:
+-------
+
+Chris Venter chris.venter@gmail.com http://rocketpod.blogspot.com
diff --git a/3rdParty/libb64/BENCHMARKS b/3rdParty/libb64/BENCHMARKS
new file mode 100644
index 0000000..fd34056
--- /dev/null
+++ b/3rdParty/libb64/BENCHMARKS
@@ -0,0 +1,85 @@
+-- Intro
+
+Some people have expressed opinions about how
+fast libb64's encoding and decoding routines
+are, as compared to some other BASE64 packages
+out there.
+
+This document shows the result of a short and sweet
+benchmark, which takes a large-ish file and
+encodes/decodes it a number of times.
+The winner is the executable that does this task the quickest.
+
+-- Platform
+
+The tests were all run on a Fujitsu-Siemens laptop,
+with a Pentium M processor running at 2GHz, with
+1GB of RAM, running Ubuntu 10.4.
+
+-- Packages
+
+The following BASE64 packages were used in this benchmark:
+
+- libb64-1.2 (libb64-base64)
+ From libb64.sourceforge.net
+ Size of executable: 18808 bytes
+ Compiled with:
+ CFLAGS += -O3
+ BUFFERSIZE = 16777216
+
+- base64-1.5 (fourmilab-base64)
+ From http://www.fourmilab.ch/webtools/base64/
+ Size of executable: 20261 bytes
+ Compiled with Default package settings
+
+- coreutils 7.4-2ubuntu2 (coreutils-base64)
+ From http://www.gnu.org/software/coreutils/
+ Size of executable: 38488 bytes
+ Default binary distributed with Ubuntu 10.4
+
+-- Input File
+
+Using blender-2.49b-linux-glibc236-py25-i386.tar.bz2
+from http://www.blender.org/download/get-blender/
+Size: 18285329 bytes
+(approx. 18MB)
+
+-- Method
+
+Encode and Decode the Input file 50 times in a loop,
+using a simple shell script, and get the running time.
+
+-- Results
+
+$ time ./benchmark-libb64.sh
+real 0m28.389s
+user 0m14.077s
+sys 0m12.309s
+
+$ time ./benchmark-fourmilab.sh
+real 1m43.160s
+user 1m23.769s
+sys 0m8.737s
+
+$ time ./benchmark-coreutils.sh
+real 0m36.288s
+user 0m24.746s
+sys 0m8.181s
+
+28.389 for 18MB * 50
+= 28.389 for 900
+
+-- Conclusion
+
+libb64 is the fastest encoder/decoder, and
+has the smallest executable size.
+
+On average it will encode and decode at roughly 31.7MB/second.
+
+The closest "competitor" is base64 from GNU coreutils, which
+reaches only 24.8MB/second.
+
+--
+14/06/2010
+chris.venter@gmail.com
+
diff --git a/3rdParty/libb64/CHANGELOG b/3rdParty/libb64/CHANGELOG
new file mode 100644
index 0000000..6fd1c17
--- /dev/null
+++ b/3rdParty/libb64/CHANGELOG
@@ -0,0 +1,25 @@
+libb64: Base64 Encoding/Decoding Routines
+======================================
+
+## Changelog ##
+
+Version 1.2 Release
+-------------------
+Removed the b64dec, b64enc, encoder and decoder programs in favour of
+a better example, called base64, which encodes and decodes
+depending on its arguments.
+
+Created a solution for Microsoft Visual Studio C++ Express 2010
+edition, which simply builds the base64 example as a console application.
+
+Version 1.1 Release
+-------------------
+Modified encode.h to (correctly) read from the iostream argument,
+instead of std::cin.
+Thanks to Peter K. Lee for the heads-up.
+
+No API changes.
+
+Version 1.0 Release
+-------------------
+The current content is the changeset.
diff --git a/3rdParty/libb64/INSTALL b/3rdParty/libb64/INSTALL
new file mode 100644
index 0000000..b05f5db
--- /dev/null
+++ b/3rdParty/libb64/INSTALL
@@ -0,0 +1,44 @@
+libb64: Base64 Encoding/Decoding Routines
+======================================
+
+Requirements:
+------------
+This piece of software has minimal requirements.
+
+I have tested it on the following systems:
+
+- a Linux machine, with the following specs:
+(this was the original development machine)
+ * FedoraCore 4
+ * kernel v. 2.6.11 (stock FC4 kernel)
+ * gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)
+ * glibc-2.3.5-10
+ * make v. 3.80
+ * some arb version of makedepend
+
+- Windows XP machine
+ * MSYS 1.0
+ * MinGW 5.1.4
+ * gcc version 3.4.5 (mingw-vista special r3)
+
+- Windows XP machine (same as above)
+ * Microsoft Visual Studio 2010, Version 10.0.30319.1 RTMRel
+
+Barring any serious screwups on my part, this code should compile and run sweetly
+under Cygwin and other systems too. If you DO get it running under some weird arch/os setup,
+send me a mail, please.
+
+Compiling:
+---------
+There is no configure. It would be overkill for something so simple...
+Run make in the root directory.
+
+Installing:
+----------
+Since the current targets are a standalone executable and a static library
+(fancy name for archive) with some headers, an install script has not been implemented yet.
+Simply copy the executable into your path, and use it.
+
+--
+peace out
+Chris
diff --git a/3rdParty/libb64/LICENSE b/3rdParty/libb64/LICENSE
new file mode 100644
index 0000000..a6b5606
--- /dev/null
+++ b/3rdParty/libb64/LICENSE
@@ -0,0 +1,29 @@
+Copyright-Only Dedication (based on United States law)
+or Public Domain Certification
+
+The person or persons who have associated work with this document (the
+"Dedicator" or "Certifier") hereby either (a) certifies that, to the best of
+his knowledge, the work of authorship identified is in the public domain of the
+country from which the work is published, or (b) hereby dedicates whatever
+copyright the dedicators holds in the work of authorship identified below (the
+"Work") to the public domain. A certifier, moreover, dedicates any copyright
+interest he may have in the associated work, and for these purposes, is
+described as a "dedicator" below.
+
+A certifier has taken reasonable steps to verify the copyright status of this
+work. Certifier recognizes that his good faith efforts may not shield him from
+liability if in fact the work certified is not in the public domain.
+
+Dedicator makes this dedication for the benefit of the public at large and to
+the detriment of the Dedicator's heirs and successors. Dedicator intends this
+dedication to be an overt act of relinquishment in perpetuity of all present
+and future rights under copyright law, whether vested or contingent, in the
+Work. Dedicator understands that such relinquishment of all rights includes
+the relinquishment of all rights to enforce (by lawsuit or otherwise) those
+copyrights in the Work.
+
+Dedicator recognizes that, once placed in the public domain, the Work may be
+freely reproduced, distributed, transmitted, used, modified, built upon, or
+otherwise exploited by anyone for any purpose, commercial or non-commercial,
+and in any way, including by methods that have not yet been invented or
+conceived. \ No newline at end of file
diff --git a/3rdParty/libb64/Makefile.orig b/3rdParty/libb64/Makefile.orig
new file mode 100644
index 0000000..fc41310
--- /dev/null
+++ b/3rdParty/libb64/Makefile.orig
@@ -0,0 +1,25 @@
+all: all_src all_base64
+
+all_src:
+ $(MAKE) -C src
+all_base64: all_src
+ $(MAKE) -C base64
+
+clean: clean_src clean_base64 clean_include
+ rm -f *~ *.bak
+
+clean_include:
+ rm -f include/b64/*~
+
+clean_src:
+ $(MAKE) -C src clean;
+clean_base64:
+ $(MAKE) -C base64 clean;
+
+distclean: clean distclean_src distclean_base64
+
+distclean_src:
+ $(MAKE) -C src distclean;
+distclean_base64:
+ $(MAKE) -C base64 distclean;
+
diff --git a/3rdParty/libb64/README b/3rdParty/libb64/README
new file mode 100644
index 0000000..be93b7b
--- /dev/null
+++ b/3rdParty/libb64/README
@@ -0,0 +1,138 @@
+b64: Base64 Encoding/Decoding Routines
+======================================
+
+Overview:
+--------
+libb64 is a library of ANSI C routines for fast encoding/decoding data into and
+from a base64-encoded format. C++ wrappers are included, as well as the source
+code for standalone encoding and decoding executables.
+
+base64 consists of ASCII text, and is therefore a useful encoding for storing
+binary data in a text file, such as xml, or sending binary data over text-only
+email.
+
+References:
+----------
+* Wikipedia article:
+ http://en.wikipedia.org/wiki/Base64
+* base64, another implementation of a commandline en/decoder:
+ http://www.fourmilab.ch/webtools/base64/
+
+Why?
+---
+I did this because I need an implementation of base64 encoding and decoding,
+without any licensing problems. Most OS implementations are released under
+either the GNU/GPL, or a BSD-variant, which is not what I require.
+
+Also, the chance to actually use the co-routine implementation in code is rare,
+and its use here is fitting. I couldn't pass up the chance.
+For more information on this technique, see "Coroutines in C", by Simon Tatham,
+which can be found online here:
+http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
+
+So then, under which license do I release this code? On to the next section...
+
+License:
+-------
+This work is released under into the Public Domain.
+It basically boils down to this: I put this work in the public domain, and you
+can take it and do whatever you want with it.
+
+An example of this "license" is the Creative Commons Public Domain License, a
+copy of which can be found in the LICENSE file, and also online at
+http://creativecommons.org/licenses/publicdomain/
+
+Commandline Use:
+---------------
+There is a new executable available, it is simply called base64.
+It can encode and decode files, as instructed by the user.
+
+To encode a file:
+$ ./base64 -e filea fileb
+fileb will now be the base64-encoded version of filea.
+
+To decode a file:
+$ ./base64 -d fileb filec
+filec will now be identical to filea.
+
+Programming:
+-----------
+Some C++ wrappers are provided as well, so you don't have to get your hands
+dirty. Encoding from standard input to standard output is as simple as
+
+ #include <b64/encode.h>
+ #include <iostream>
+ int main()
+ {
+ base64::encoder E;
+ E.encode(std::cin, std::cout);
+ return 0;
+ }
+
+Both standalone executables and a static library is provided in the package,
+
+Implementation:
+--------------
+It is DAMN fast, if I may say so myself. The C code uses a little trick which
+has been used to implement coroutines, of which one can say that this
+implementation is an example.
+
+(To see how the libb64 codebase compares with some other BASE64 implementations
+available, see the BENCHMARKS file)
+
+The trick involves the fact that a switch-statement may legally cross into
+sub-blocks. A very thorough and enlightening essay on co-routines in C, using
+this method, can be found in the above mentioned "Coroutines in C", by Simon
+Tatham: http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
+
+For example, an RLE decompressing routine, adapted from the article:
+1 static int STATE = 0;
+2 static int len, c;
+3 switch (STATE)
+4 {
+5 while (1)
+6 {
+7 c = getchar();
+8 if (c == EOF) return EOF;
+9 if (c == 0xFF) {
+10 len = getchar();
+11 c = getchar();
+12 while (len--)
+13 {
+14 STATE = 0;
+15 return c;
+16 case 0:
+17 }
+18 } else
+19 STATE = 1;
+20 return c;
+21 case 1:
+22 }
+23 }
+24 }
+
+As can be seen from this example, a coroutine depends on a state variable,
+which it sets directly before exiting (lines 14 and 119). The next time the
+routine is entered, the switch moves control to the specific point directly
+after the previous exit (lines 16 and 21).hands
+
+(As an aside, in the mentioned article the combination of the top-level switch,
+the various setting of the state, the return of a value, and the labelling of
+the exit point is wrapped in #define macros, making the structure of the
+routine even clearer.)
+
+The obvious problem with any such routine is the static keyword.
+Any static variables in a function spell doom for multithreaded applications.
+Also, in situations where this coroutine is used by more than one other
+coroutines, the consistency is disturbed.
+
+What is needed is a structure for storing these variabled, which is passed to
+the routine seperately. This obviously breaks the modularity of the function,
+since now the caller has to worry about and care for the internal state of the
+routine (the callee). This allows for a fast, multithreading-enabled
+implementation, which may (obviously) be wrapped in a C++ object for ease of
+use.
+
+The base64 encoding and decoding functionality in this package is implemented
+in exactly this way, providing both a high-speed high-maintanence C interface,
+and a wrapped C++ which is low-maintanence and only slightly less performant.
diff --git a/3rdParty/libb64/TODO b/3rdParty/libb64/TODO
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/3rdParty/libb64/TODO
diff --git a/3rdParty/libb64/base64/Makefile b/3rdParty/libb64/base64/Makefile
new file mode 100644
index 0000000..30a2c5c
--- /dev/null
+++ b/3rdParty/libb64/base64/Makefile
@@ -0,0 +1,56 @@
+BINARIES = base64
+
+# Build flags (uncomment one)
+#############################
+# Release build flags
+CFLAGS += -O3
+#############################
+# Debug build flags
+#CFLAGS += -g
+#############################
+
+# select a buffersize
+# a larger size should be faster, but takes more runtime memory
+#BUFFERSIZE = 4096
+#BUFFERSIZE = 65536
+BUFFERSIZE = 16777216
+
+SOURCES = base64.cc
+
+TARGETS = $(BINARIES)
+
+LINK.o = g++
+
+CFLAGS += -Werror -pedantic
+CFLAGS += -DBUFFERSIZE=$(BUFFERSIZE)
+CFLAGS += -I../include
+
+CXXFLAGS += $(CFLAGS)
+
+vpath %.h ../include/b64
+vpath %.a ../src
+
+.PHONY : clean
+
+all: $(TARGETS) #strip
+
+base64: libb64.a
+
+strip:
+ strip $(BINARIES) *.exe
+
+clean: clean_VisualStudioProject
+ rm -f *.exe* *.o $(TARGETS) *.bak *~
+clean_VisualStudioProject:
+ $(MAKE) -C VisualStudioProject clean
+
+distclean: clean distclean_VisualStudioProject
+ rm -f depend
+distclean_VisualStudioProject: clean_VisualStudioProject
+ $(MAKE) -C VisualStudioProject distclean
+
+depend: $(SOURCES)
+ makedepend -f- $(CFLAGS) $(SOURCES) 2> /dev/null 1> depend
+
+-include depend
+
diff --git a/3rdParty/libb64/base64/VisualStudioProject/Makefile b/3rdParty/libb64/base64/VisualStudioProject/Makefile
new file mode 100644
index 0000000..047fcb9
--- /dev/null
+++ b/3rdParty/libb64/base64/VisualStudioProject/Makefile
@@ -0,0 +1,11 @@
+DEBRIS = base64.sdf base64.suo base64.vcxproj.user
+
+all:
+
+clean:
+ rm -rf Debug Release
+
+distclean: clean
+ rm -f $(DEBRIS)
+
+ \ No newline at end of file
diff --git a/3rdParty/libb64/base64/VisualStudioProject/base64.sln b/3rdParty/libb64/base64/VisualStudioProject/base64.sln
new file mode 100644
index 0000000..b357a9c
--- /dev/null
+++ b/3rdParty/libb64/base64/VisualStudioProject/base64.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base64", "base64.vcxproj", "{0B094121-DC64-4D74-AFA0-750B83F800D0}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0B094121-DC64-4D74-AFA0-750B83F800D0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0B094121-DC64-4D74-AFA0-750B83F800D0}.Debug|Win32.Build.0 = Debug|Win32
+ {0B094121-DC64-4D74-AFA0-750B83F800D0}.Release|Win32.ActiveCfg = Release|Win32
+ {0B094121-DC64-4D74-AFA0-750B83F800D0}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj b/3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj
new file mode 100644
index 0000000..530aec4
--- /dev/null
+++ b/3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{0B094121-DC64-4D74-AFA0-750B83F800D0}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>base64</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>BUFFERSIZE=16777216;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>H:\builds\libb64\working.libb64\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>BUFFERSIZE=16777216;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>H:\builds\libb64\working.libb64\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\src\cdecode.c" />
+ <ClCompile Include="..\..\src\cencode.c" />
+ <ClCompile Include="..\base64.cc" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\b64\cdecode.h" />
+ <ClInclude Include="..\..\include\b64\cencode.h" />
+ <ClInclude Include="..\..\include\b64\decode.h" />
+ <ClInclude Include="..\..\include\b64\encode.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj.filters b/3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj.filters
new file mode 100644
index 0000000..34a1105
--- /dev/null
+++ b/3rdParty/libb64/base64/VisualStudioProject/base64.vcxproj.filters
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{12b9f2a2-b899-409a-a507-8cefe9c39b25}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{ce5598bd-67f3-430f-890b-cefa880e9405}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\base64.cc">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\cencode.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\src\cdecode.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\b64\encode.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\b64\cdecode.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\b64\cencode.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\b64\decode.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/3rdParty/libb64/base64/base64.cc b/3rdParty/libb64/base64/base64.cc
new file mode 100644
index 0000000..acab416
--- /dev/null
+++ b/3rdParty/libb64/base64/base64.cc
@@ -0,0 +1,94 @@
+/*
+base64.cc - c++ source to a base64 reference encoder and decoder
+
+This is part of the libb64 project, and has been placed in the public domain.
+For details, see http://sourceforge.net/projects/libb64
+*/
+
+#include <b64/encode.h>
+#include <b64/decode.h>
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+#include <stdlib.h>
+
+// Function which prints the usage of this executable
+void usage()
+{
+ std::cerr<< \
+ "base64: Encodes and Decodes files using base64\n" \
+ "Usage: base64 [-e|-d] [input] [output]\n" \
+ " Where [-e] will encode the input file into the output file,\n" \
+ " [-d] will decode the input file into the output file, and\n" \
+ " [input] and [output] are the input and output files, respectively.\n";
+}
+// Function which prints the usage of this executable, plus a short message
+void usage(const std::string& message)
+{
+ usage();
+ std::cerr<<"Incorrect invocation of base64:\n";
+ std::cerr<<message<<std::endl;
+}
+
+int main(int argc, char** argv)
+{
+ // Quick check for valid arguments
+ if (argc == 1)
+ {
+ usage();
+ exit(-1);
+ }
+ if (argc != 4)
+ {
+ usage("Wrong number of arguments!");
+ exit(-1);
+ }
+
+ // So far so good; try to open the input file
+ std::string input = argv[2];
+ // Note that we have to open the input in binary mode.
+ // This is due to some operating systems not using binary mode by default.
+ // Since we will most likely be dealing with binary files when encoding, we
+ // have to be able to deal with zeros (and other invalid chars) in the input stream.
+ std::ifstream instream(input.c_str(), std::ios_base::in | std::ios_base::binary);
+ if (!instream.is_open())
+ {
+ usage("Could not open input file!");
+ exit(-1);
+ }
+
+ // Now try to open the output file
+ std::string output = argv[3];
+ // Again, note that we have to open the ouput in binary mode.
+ // Similiarly, we will most likely need to deal with zeros in the output stream when we
+ // are decoding, and the output stream has to be able to use these invalid text chars.
+ std::ofstream outstream(output.c_str(), std::ios_base::out | std::ios_base::binary);
+ if (!outstream.is_open())
+ {
+ usage("Could not open output file!");
+ exit(-1);
+ }
+
+ // determine whether we need to encode or decode:
+ std::string choice = argv[1];
+ if (choice == "-d")
+ {
+ base64::decoder D;
+ D.decode(instream, outstream);
+ }
+ else if (choice == "-e")
+ {
+ base64::encoder E;
+ E.encode(instream, outstream);
+ }
+ else
+ {
+ std::cout<<"["<<choice<<"]"<<std::endl;
+ usage("Please specify -d or -e as first argument!");
+ }
+
+ return 0;
+}
+
diff --git a/3rdParty/libb64/include/b64/cdecode.h b/3rdParty/libb64/include/b64/cdecode.h
new file mode 100644
index 0000000..d0d7f48
--- /dev/null
+++ b/3rdParty/libb64/include/b64/cdecode.h
@@ -0,0 +1,28 @@
+/*
+cdecode.h - c header for a base64 decoding algorithm
+
+This is part of the libb64 project, and has been placed in the public domain.
+For details, see http://sourceforge.net/projects/libb64
+*/
+
+#ifndef BASE64_CDECODE_H
+#define BASE64_CDECODE_H
+
+typedef enum
+{
+ step_a, step_b, step_c, step_d
+} base64_decodestep;
+
+typedef struct
+{
+ base64_decodestep step;
+ char plainchar;
+} base64_decodestate;
+
+void base64_init_decodestate(base64_decodestate* state_in);
+
+int base64_decode_value(char value_in);
+
+int base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in);
+
+#endif /* BASE64_CDECODE_H */
diff --git a/3rdParty/libb64/include/b64/cencode.h b/3rdParty/libb64/include/b64/cencode.h
new file mode 100644
index 0000000..c1e3464
--- /dev/null
+++ b/3rdParty/libb64/include/b64/cencode.h
@@ -0,0 +1,31 @@
+/*
+cencode.h - c header for a base64 encoding algorithm
+
+This is part of the libb64 project, and has been placed in the public domain.
+For details, see http://sourceforge.net/projects/libb64
+*/
+
+#ifndef BASE64_CENCODE_H
+#define BASE64_CENCODE_H
+
+typedef enum
+{
+ step_A, step_B, step_C
+} base64_encodestep;
+
+typedef struct
+{
+ base64_encodestep step;
+ char result;
+ int stepcount;
+} base64_encodestate;
+
+void base64_init_encodestate(base64_encodestate* state_in);
+
+char base64_encode_value(char value_in);
+
+int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in);
+
+int base64_encode_blockend(char* code_out, base64_encodestate* state_in);
+
+#endif /* BASE64_CENCODE_H */
diff --git a/3rdParty/libb64/include/b64/decode.h b/3rdParty/libb64/include/b64/decode.h
new file mode 100644
index 0000000..12b16ea
--- /dev/null
+++ b/3rdParty/libb64/include/b64/decode.h
@@ -0,0 +1,70 @@
+// :mode=c++:
+/*
+decode.h - c++ wrapper for a base64 decoding algorithm
+
+This is part of the libb64 project, and has been placed in the public domain.
+For details, see http://sourceforge.net/projects/libb64
+*/
+#ifndef BASE64_DECODE_H
+#define BASE64_DECODE_H
+
+#include <iostream>
+
+namespace base64
+{
+ extern "C"
+ {
+ #include "cdecode.h"
+ }
+
+ struct decoder
+ {
+ base64_decodestate _state;
+ int _buffersize;
+
+ decoder(int buffersize_in = BUFFERSIZE)
+ : _buffersize(buffersize_in)
+ {}
+
+ int decode(char value_in)
+ {
+ return base64_decode_value(value_in);
+ }
+
+ int decode(const char* code_in, const int length_in, char* plaintext_out)
+ {
+ return base64_decode_block(code_in, length_in, plaintext_out, &_state);
+ }
+
+ void decode(std::istream& istream_in, std::ostream& ostream_in)
+ {
+ base64_init_decodestate(&_state);
+ //
+ const int N = _buffersize;
+ char* code = new char[N];
+ char* plaintext = new char[N];
+ int codelength;
+ int plainlength;
+
+ do
+ {
+ istream_in.read((char*)code, N);
+ codelength = istream_in.gcount();
+ plainlength = decode(code, codelength, plaintext);
+ ostream_in.write((const char*)plaintext, plainlength);
+ }
+ while (istream_in.good() && codelength > 0);
+ //
+ base64_init_decodestate(&_state);
+
+ delete [] code;
+ delete [] plaintext;
+ }
+ };
+
+} // namespace base64
+
+
+
+#endif // BASE64_DECODE_H
+
diff --git a/3rdParty/libb64/include/b64/encode.h b/3rdParty/libb64/include/b64/encode.h
new file mode 100644
index 0000000..5d807d9
--- /dev/null
+++ b/3rdParty/libb64/include/b64/encode.h
@@ -0,0 +1,77 @@
+// :mode=c++:
+/*
+encode.h - c++ wrapper for a base64 encoding algorithm
+
+This is part of the libb64 project, and has been placed in the public domain.
+For details, see http://sourceforge.net/projects/libb64
+*/
+#ifndef BASE64_ENCODE_H
+#define BASE64_ENCODE_H
+
+#include <iostream>
+
+namespace base64
+{
+ extern "C"
+ {
+ #include "cencode.h"
+ }
+
+ struct encoder
+ {
+ base64_encodestate _state;
+ int _buffersize;
+
+ encoder(int buffersize_in = BUFFERSIZE)
+ : _buffersize(buffersize_in)
+ {}
+
+ int encode(char value_in)
+ {
+ return base64_encode_value(value_in);
+ }
+
+ int encode(const char* code_in, const int length_in, char* plaintext_out)
+ {
+ return base64_encode_block(code_in, length_in, plaintext_out, &_state);
+ }
+
+ int encode_end(char* plaintext_out)
+ {
+ return base64_encode_blockend(plaintext_out, &_state);
+ }
+
+ void encode(std::istream& istream_in, std::ostream& ostream_in)
+ {
+ base64_init_encodestate(&_state);
+ //
+ const int N = _buffersize;
+ char* plaintext = new char[N];
+ char* code = new char[2*N];
+ int plainlength;
+ int codelength;
+
+ do
+ {
+ istream_in.read(plaintext, N);
+ plainlength = istream_in.gcount();
+ //
+ codelength = encode(plaintext, plainlength, code);
+ ostream_in.write(code, codelength);
+ }
+ while (istream_in.good() && plainlength > 0);
+
+ codelength = encode_end(code);
+ ostream_in.write(code, codelength);
+ //
+ base64_init_encodestate(&_state);
+
+ delete [] code;
+ delete [] plaintext;
+ }
+ };
+
+} // namespace base64
+
+#endif // BASE64_ENCODE_H
+
diff --git a/3rdParty/libb64/src/Makefile b/3rdParty/libb64/src/Makefile
new file mode 100644
index 0000000..28b2382
--- /dev/null
+++ b/3rdParty/libb64/src/Makefile
@@ -0,0 +1,43 @@
+LIBRARIES = libb64.a
+
+# Build flags (uncomment one)
+#############################
+# Release build flags
+CFLAGS += -O3
+#############################
+# Debug build flags
+#CFLAGS += -g
+#############################
+
+SOURCES = cdecode.c cencode.c
+
+TARGETS = $(LIBRARIES)
+
+LINK.o = gcc
+
+CFLAGS += -Werror -pedantic
+CFLAGS += -I../include
+
+vpath %.h ../include/b64
+
+.PHONY : clean
+
+all: $(TARGETS) #strip
+
+libb64.a: cencode.o cdecode.o
+ $(AR) $(ARFLAGS) $@ $^
+
+strip:
+ strip $(BINARIES) *.exe
+
+clean:
+ rm -f *.exe* *.o $(TARGETS) *.bak *~
+
+distclean: clean
+ rm -f depend
+
+depend: $(SOURCES)
+ makedepend -f- $(CFLAGS) $(SOURCES) 2> /dev/null 1> depend
+
+-include depend
+
diff --git a/3rdParty/libb64/src/cdecode.c b/3rdParty/libb64/src/cdecode.c
new file mode 100644
index 0000000..34509c9
--- /dev/null
+++ b/3rdParty/libb64/src/cdecode.c
@@ -0,0 +1,88 @@
+/*
+cdecoder.c - c source to a base64 decoding algorithm implementation
+
+This is part of the libb64 project, and has been placed in the public domain.
+For details, see http://sourceforge.net/projects/libb64
+*/
+
+#include <b64/cdecode.h>
+
+int base64_decode_value(char value_in)
+{
+ static const char decoding[] = {62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
+ static const char decoding_size = sizeof(decoding);
+ value_in -= 43;
+ if (value_in < 0 || value_in > decoding_size) return -1;
+ return decoding[(int)value_in];
+}
+
+void base64_init_decodestate(base64_decodestate* state_in)
+{
+ state_in->step = step_a;
+ state_in->plainchar = 0;
+}
+
+int base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in)
+{
+ const char* codechar = code_in;
+ char* plainchar = plaintext_out;
+ char fragment;
+
+ *plainchar = state_in->plainchar;
+
+ switch (state_in->step)
+ {
+ while (1)
+ {
+ case step_a:
+ do {
+ if (codechar == code_in+length_in)
+ {
+ state_in->step = step_a;
+ state_in->plainchar = *plainchar;
+ return plainchar - plaintext_out;
+ }
+ fragment = (char)base64_decode_value(*codechar++);
+ } while (fragment < 0);
+ *plainchar = (fragment & 0x03f) << 2;
+ case step_b:
+ do {
+ if (codechar == code_in+length_in)
+ {
+ state_in->step = step_b;
+ state_in->plainchar = *plainchar;
+ return plainchar - plaintext_out;
+ }
+ fragment = (char)base64_decode_value(*codechar++);
+ } while (fragment < 0);
+ *plainchar++ |= (fragment & 0x030) >> 4;
+ *plainchar = (fragment & 0x00f) << 4;
+ case step_c:
+ do {
+ if (codechar == code_in+length_in)
+ {
+ state_in->step = step_c;
+ state_in->plainchar = *plainchar;
+ return plainchar - plaintext_out;
+ }
+ fragment = (char)base64_decode_value(*codechar++);
+ } while (fragment < 0);
+ *plainchar++ |= (fragment & 0x03c) >> 2;
+ *plainchar = (fragment & 0x003) << 6;
+ case step_d:
+ do {
+ if (codechar == code_in+length_in)
+ {
+ state_in->step = step_d;
+ state_in->plainchar = *plainchar;
+ return plainchar - plaintext_out;
+ }
+ fragment = (char)base64_decode_value(*codechar++);
+ } while (fragment < 0);
+ *plainchar++ |= (fragment & 0x03f);
+ }
+ }
+ /* control should not reach here */
+ return plainchar - plaintext_out;
+}
+
diff --git a/3rdParty/libb64/src/cencode.c b/3rdParty/libb64/src/cencode.c
new file mode 100644
index 0000000..03ba5b6
--- /dev/null
+++ b/3rdParty/libb64/src/cencode.c
@@ -0,0 +1,109 @@
+/*
+cencoder.c - c source to a base64 encoding algorithm implementation
+
+This is part of the libb64 project, and has been placed in the public domain.
+For details, see http://sourceforge.net/projects/libb64
+*/
+
+#include <b64/cencode.h>
+
+const int CHARS_PER_LINE = 72;
+
+void base64_init_encodestate(base64_encodestate* state_in)
+{
+ state_in->step = step_A;
+ state_in->result = 0;
+ state_in->stepcount = 0;
+}
+
+char base64_encode_value(char value_in)
+{
+ static const char* encoding = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ if (value_in > 63) return '=';
+ return encoding[(int)value_in];
+}
+
+int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in)
+{
+ const char* plainchar = plaintext_in;
+ const char* const plaintextend = plaintext_in + length_in;
+ char* codechar = code_out;
+ char result;
+ char fragment;
+
+ result = state_in->result;
+
+ switch (state_in->step)
+ {
+ while (1)
+ {
+ case step_A:
+ if (plainchar == plaintextend)
+ {
+ state_in->result = result;
+ state_in->step = step_A;
+ return codechar - code_out;
+ }
+ fragment = *plainchar++;
+ result = (fragment & 0x0fc) >> 2;
+ *codechar++ = base64_encode_value(result);
+ result = (fragment & 0x003) << 4;
+ case step_B:
+ if (plainchar == plaintextend)
+ {
+ state_in->result = result;
+ state_in->step = step_B;
+ return codechar - code_out;
+ }
+ fragment = *plainchar++;
+ result |= (fragment & 0x0f0) >> 4;
+ *codechar++ = base64_encode_value(result);
+ result = (fragment & 0x00f) << 2;
+ case step_C:
+ if (plainchar == plaintextend)
+ {
+ state_in->result = result;
+ state_in->step = step_C;
+ return codechar - code_out;
+ }
+ fragment = *plainchar++;
+ result |= (fragment & 0x0c0) >> 6;
+ *codechar++ = base64_encode_value(result);
+ result = (fragment & 0x03f) >> 0;
+ *codechar++ = base64_encode_value(result);
+
+ ++(state_in->stepcount);
+ if (state_in->stepcount == CHARS_PER_LINE/4)
+ {
+ *codechar++ = '\n';
+ state_in->stepcount = 0;
+ }
+ }
+ }
+ /* control should not reach here */
+ return codechar - code_out;
+}
+
+int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
+{
+ char* codechar = code_out;
+
+ switch (state_in->step)
+ {
+ case step_B:
+ *codechar++ = base64_encode_value(state_in->result);
+ *codechar++ = '=';
+ *codechar++ = '=';
+ break;
+ case step_C:
+ *codechar++ = base64_encode_value(state_in->result);
+ *codechar++ = '=';
+ break;
+ case step_A:
+ break;
+ }
+ *codechar++ = '\n';
+
+ return codechar - code_out;
+}
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 864be72..e88ea9a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,10 +11,15 @@ find_path(CPPDB_INC cppdb/frontend.h)
add_subdirectory(3rdParty)
+add_definitions(
+ "-DBUFFERSIZE=4096"
+)
+
include_directories(${CPPCMS_INC})
include_directories(${BOOSTER_INC})
include_directories(${CPPDB_INC})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/libb64/include)
find_program(TMPLCC cppcms_tmpl_cc)
find_program(XGETTEXT xgettext)
@@ -52,12 +57,14 @@ add_custom_command(
if(USE_STATIC_VIEW)
add_executable(strusCms ${SRC} ${CMAKE_CURRENT_BINARY_DIR}/view.cpp)
else()
- add_executable(strusCms ${SRC})
+ add_executable(strusCms ${SRC} ${CAPTCHA})
add_library(view SHARED ${CMAKE_CURRENT_BINARY_DIR}/view.cpp)
target_link_libraries(view ${BOOSTER} ${CPPCMS})
endif()
-target_link_libraries(strusCms ${BOOSTER} ${CPPCMS} ${CPPDB})
+link_directories( "${PROJECT_SOURCE_DIR}/3rdParty/captcha" )
+link_directories( "${PROJECT_SOURCE_DIR}/3rdParty/libb64" )
+target_link_libraries(strusCms ${BOOSTER} ${CPPCMS} ${CPPDB} captcha b64)
#~ set(LOCALES de fr)
#~
diff --git a/src/base64.cpp b/src/base64.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/base64.cpp
diff --git a/src/base64.hpp b/src/base64.hpp
new file mode 100644
index 0000000..1c55655
--- /dev/null
+++ b/src/base64.hpp
@@ -0,0 +1,4 @@
+#ifndef BASE64_HPP
+#define BASE64_HPP
+
+#endif
diff --git a/src/user.cpp b/src/user.cpp
index 8f18706..d94cd6f 100644
--- a/src/user.cpp
+++ b/src/user.cpp
@@ -7,6 +7,8 @@
#include <cppdb/frontend.h>
#include <cppcms/session_interface.h>
#include <booster/posix_time.h>
+#include <b64/encode.h>
+#include <sstream>
namespace apps {
@@ -81,10 +83,40 @@ bool user::check_login( std::string user, std::string password )
return true;
}
+#define GIFSIZE 17646
+extern "C" {
+ const int gifsize = GIFSIZE;
+ void captcha( unsigned char im[70*200], unsigned char l[6]);
+ void makegif(unsigned char im[70*200], unsigned char gif[gifsize]);
+}
+
void user::ini( content::user &c )
{
master::ini( c );
- c.captcha = ">> CAPTCHA <<";
+ unsigned char l[6];
+ unsigned char *im = new unsigned char[70*200];
+ unsigned char *gif = new unsigned char[gifsize];
+
+ captcha( im, l );
+ c.captcha_text = std::string( (char *)l );
+
+ std::ostringstream raws( std::stringstream::out | std::stringstream::binary );
+ makegif( im, gif );
+ raws.write( (char *)gif, gifsize );
+ std::string raw = raws.str( );
+
+ std::istringstream in( std::ios_base::in | std::ios_base::binary );
+ in.str( raw );
+
+ base64::encoder E;
+ std::string base_s;
+ base_s.reserve( 3 * gifsize );
+ std::ostringstream base( base_s, std::stringstream::out | std::stringstream::binary );
+ E.encode( in, base );
+ c.captcha_base64 = base.str( );
+
+ delete gif;
+ delete im;
}
} // namespace apps
diff --git a/src/user_content.hpp b/src/user_content.hpp
index 887c61a..857a15c 100644
--- a/src/user_content.hpp
+++ b/src/user_content.hpp
@@ -22,7 +22,8 @@ struct login_form : public cppcms::form {
struct user : public master {
login_form login;
- std::string captcha;
+ std::string captcha_text;
+ std::string captcha_base64;
public:
user( apps::strusCms &cms );
diff --git a/templates/login.tmpl b/templates/login.tmpl
index e965ba1..2e58888 100644
--- a/templates/login.tmpl
+++ b/templates/login.tmpl
@@ -12,8 +12,9 @@
<table>
<% form as_table login %>
</table>
- <%= captcha %>
</form>
+ <br/>
+ <img src="data:image/gif;base64,<%= captcha_base64 %>"/>
</div>
<% end template %>
diff --git a/templates/master.tmpl b/templates/master.tmpl
index fb871d0..b80d0f9 100644
--- a/templates/master.tmpl
+++ b/templates/master.tmpl
@@ -23,6 +23,7 @@
<li><a href="http://project-strus.net">Strus</a><br/>a collection of C++ libraries for building a full-text search engine</li>
<li><a href="http://cppcms.com/wikipp/en/page/main">CppCMS</a><br/>a C++ web programming framework</li>
<li><a href="http://brokestream.com/captcha.html"</li>libcaptcha</a><br/>a C standalone Captcha generator</li>
+ <li><a href="http://libb64.sourceforge.net/"</li>libb64</a><br/>a BASE64 encoder/decoder library</li>
</ul>
</div>