diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-01-23 23:51:22 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-01-23 23:56:16 +0200 |
commit | 2a76106cbd56643757ab8096c4674bb55253a1ed (patch) | |
tree | 19f4ea321915055e1535ae7d396c0dce11793d5a | |
parent | eb80640a4753350f000cbe0ee49f5a6a2bd5bc75 (diff) | |
download | vmod-basicauth-2a76106cbd56643757ab8096c4674bb55253a1ed.tar.gz vmod-basicauth-2a76106cbd56643757ab8096c4674bb55253a1ed.tar.bz2 |
Varnish 4.1
* .gitmodules: New file.
* acvmod: New submodule.
* bootstrap: Update.
* Makefile.am (ACLOCAL_AMFLAGS): Add acvmod
* configure.ac: Use AM_VARNISHAPI instead of inlining
the related code.
Enable silent rules.
Set version number 1.0.90-4.1.0
* src/Makefile.am: Enable silent rules.
* tests/Makefile.am: Likewise.
* src/vmod_basicauth.c (get_priv_data): New function.
* src/vmod_basicauth.vcc: Remove init
(match): Use PRIV_TASK.
* NEWS: Update
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | NEWS | 16 | ||||
m--------- | acvmod | 0 | ||||
-rwxr-xr-x | bootstrap | 2 | ||||
-rw-r--r-- | configure.ac | 75 | ||||
-rw-r--r-- | src/Makefile.am | 20 | ||||
-rw-r--r-- | src/vmod_basicauth.c | 39 | ||||
-rw-r--r-- | src/vmod_basicauth.vcc | 5 | ||||
-rw-r--r-- | tests/Makefile.am | 4 |
10 files changed, 50 insertions, 118 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..00ae21c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "acvmod"] + path = acvmod + url = git://git.gnu.org.ua/acvmod.git diff --git a/Makefile.am b/Makefile.am index 161e965..93f0e32 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ # This file is part of vmod-basicauth -# Copyright (C) 2013-2014 Sergey Poznyakoff +# Copyright (C) 2013-2016 Sergey Poznyakoff # # Vmod-basicauth is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License # along with vmod-basicauth. If not, see <http://www.gnu.org/licenses/>. -ACLOCAL_AMFLAGS = -I m4 +ACLOCAL_AMFLAGS = -I m4 -I acvmod SUBDIRS = src tests @@ -1,9 +1,19 @@ -Vmod-basicauth NEWS -- history of user-visible changes. 2014-11-13 -Copyright (C) 2013-2014 Sergey Poznyakoff +Vmod-basicauth NEWS -- history of user-visible changes. 2016-01-23 +Copyright (C) 2013-2016 Sergey Poznyakoff See the end of file for copying conditions. Please send Vmod-basicauth bug reports to <gray@gnu.org> +Version 1.3.90-4.1.0 (git) + +* Versioning changes + +Starting with this release, the version number includes version +of Varnish API the release was designed for. + +* Support for Varnish 4,1 + + Version 1.3, 2014-11-13 Support for VCL 4.0 @@ -29,7 +39,7 @@ Initial release. Copyright information: -Copyright (C) 2013-2014 Sergey Poznyakoff +Copyright (C) 2013-2016 Sergey Poznyakoff Permission is granted to anyone to make or distribute verbatim copies of this document as received, in any medium, provided that the diff --git a/acvmod b/acvmod new file mode 160000 +Subproject f064cf4d7aa1ead1f8607b8b72baf883f015ffc @@ -3,5 +3,7 @@ for dir in m4 build-aux do test -d $dir || mkdir $dir done +git submodule init +git submodule update > ChangeLog autoreconf -f -i -s diff --git a/configure.ac b/configure.ac index ba9003b..e91fe29 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ # This file is part of vmod-basicauth -*- autoconf -*- -# Copyright (C) 2013-2014 Sergey Poznyakoff +# Copyright (C) 2013-2016 Sergey Poznyakoff # # Vmod-basicauth is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with vmod-basicauth. If not, see <http://www.gnu.org/licenses/>. AC_PREREQ(2.69) -AC_INIT([vmod-basicauth], 1.3, [gray@gnu.org]) +AC_INIT([vmod-basicauth], 1.3.90-4.1.0, [gray@gnu.org]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR(src/vmod_basicauth.vcc) @@ -23,7 +23,8 @@ AM_CONFIG_HEADER(config.h) AC_CANONICAL_SYSTEM AC_LANG(C) -AM_INIT_AUTOMAKE([1.14 gnu tar-ustar]) +AM_INIT_AUTOMAKE([1.14 gnu tar-ustar silent-rules]) +AM_SILENT_RULES([yes]) AC_GNU_SOURCE AC_PROG_CC @@ -37,77 +38,11 @@ AC_PROG_INSTALL AC_PROG_LIBTOOL AC_PROG_MAKE_SET -# Check for pkg-config -PKG_PROG_PKG_CONFIG - # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([sys/stdlib.h]) -# Check for python -AC_CHECK_PROGS(PYTHON, [python], [ - AC_MSG_ERROR([python is not found.])]) - -# Varnish source tree -AC_ARG_VAR([VARNISHSRC], [path to Varnish source tree]) -AC_ARG_WITH([varnish-source], - AC_HELP_STRING([--with-varnish-source=DIR], - [Varnish sources are located in DIR]), - [VARNISHSRC=$withval]) - -if test -z "$VARNISHSRC"; then - AC_MSG_ERROR([no Varnish source tree specified]) -fi -case "$VARNISHSRC" in -/*) ;; -*) AC_MSG_ERROR([varnish source path must be absolute pathname]) -esac - -VARNISHSRC=`cd $VARNISHSRC && pwd` -VARNISHVERSION= -AC_CHECK_FILE([$VARNISHSRC/include/varnishapi.h], - [VARNISHVERSION=3], - [AC_CHECK_FILE([$VARNISHSRC/include/vapi/vsm.h], - [VARNISHVERSION=4], - [AC_MSG_FAILURE(["$VARNISHSRC" is not a Varnish source directory])]) ]) - -AC_DEFINE_UNQUOTED([VARNISHVERSION],$VARNISHVERSION,[Varnish major version number]) -AM_CONDITIONAL([VARNISH3],[test $VARNISHVERSION -eq 3]) -AM_CONDITIONAL([VARNISH4],[test $VARNISHVERSION -eq 4]) - -# Check that varnishtest is built in the varnish source directory -AC_CHECK_FILE([$VARNISHSRC/bin/varnishtest/varnishtest], - [], - [AC_MSG_FAILURE([cannot find "$VARNISHSRC/bin/varnishtest/varnishtest". Please build your varnish source directory])] -) - -# vmod installation dir -AC_ARG_VAR([VMODDIR], [vmod installation directory]) -AC_ARG_WITH([vmoddir], - AC_HELP_STRING([--with-vmoddir=DIR], - [install modules to DIR]), - [case "$withval" in - /*) VMODDIR=$withval;; - no) unset VMODDIR;; - *) AC_MSG_ERROR([argument to --with-vmoddir must be absolute pathname]) - esac],[VMODDIR=`pkg-config --variable=vmoddir varnishapi` - if test -z "$VMODDIR"; then - AC_MSG_FAILURE([cannot determine vmod installation directory]) - fi]) - - -if test -z "$VMODDIR"; then - VMODDIR='$(libdir)/varnish/mods' -fi - -AC_CONFIG_COMMANDS([status],[ -delim="-------------------------------------------------------------------" -echo "" -echo $delim -echo "Building for Varnish version $VARNISHVERSION" -echo $delim -], -[VARNISHVERSION=$VARNISHVERSION]) +AM_VARNISHAPI AC_CONFIG_FILES([ Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 6ddcf41..9cb1ac3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -37,24 +37,12 @@ vmod_basicauth.lo: vcc_if.h CLEANFILES = vcc_if.c vcc_if.h *.rst -if VARNISH4 - vmodtool = $(VARNISHSRC)/lib/libvcc/vmodtool.py - vmodtoolargs = --strict - vccfile = $(top_srcdir)/src/vmod_basicauth.vcc -else - vmodtool = $(VARNISHSRC)/lib/libvmod_std/vmod.py - vmodtoolargs = - vccfile = vmod_basicauth.vcc3 - -vmod_basicauth.vcc3: $(top_srcdir)/src/vmod_basicauth.vcc - CLEANFILES += vmod_basicauth.vcc3 -endif - -.vcc.vcc3: - sed -n '/^\$$/{s///;s/\(Module *[^ ][^ ]*\).*/\1/;p}' $< > $@ +vmodtool = $(VARNISHSRC)/lib/libvcc/vmodtool.py +vmodtoolargs = --strict +vccfile = $(top_srcdir)/src/vmod_basicauth.vcc vcc_if.c vcc_if.h: $(vmodtool) $(vccfile) - @PYTHON@ $(vmodtool) $(vmodtoolargs) $(vccfile) + $(AM_V_GEN)$(PYTHON) $(vmodtool) $(vmodtoolargs) $(vccfile) EXTRA_DIST = \ vmod_basicauth.vcc diff --git a/src/vmod_basicauth.c b/src/vmod_basicauth.c index 9dc99c3..bd58140 100644 --- a/src/vmod_basicauth.c +++ b/src/vmod_basicauth.c @@ -25,17 +25,12 @@ #include <stdbool.h> #include <crypt.h> +#include "vcl.h" #include "vrt.h" #include "vcc_if.h" #include "pthread.h" -#if VARNISHVERSION == 3 -# define VCL_VOID void -# define VCL_BOOL unsigned -# define VCL_STRING const char * -# define MOD_CTX struct sess * -#else -# define MOD_CTX const struct vrt_ctx * -#endif + +#define MOD_CTX const struct vrt_ctx * #include "basicauth.h" #include "sha1.h" @@ -84,23 +79,23 @@ base64_decode(const unsigned char *input, size_t input_len, } while (input_len > 0); return out - output; } - + struct priv_data { - struct crypt_data cdat; + struct crypt_data cdat; }; -int -init_function(struct vmod_priv *priv, const struct VCL_conf *conf) +static struct priv_data * +get_priv_data(struct vmod_priv *priv) { - struct priv_data *p = malloc(sizeof(*p)); - - p->cdat.initialized = 0; - priv->priv = p; - priv->free = free; - - return 0; -} - + if (!priv->priv) { + struct priv_data *p = malloc(sizeof(*p)); + p->cdat.initialized = 0; + priv->priv = p; + priv->free = free; + } + return priv->priv; +} + /* Matchers */ static int @@ -237,7 +232,7 @@ vmod_match(MOD_CTX sp, struct vmod_priv *priv, VCL_STRING file, VCL_STRING s) *q++ = 0; if (strcmp(p, buf)) continue; - rc = match(pass, q, priv->priv) == 0; + rc = match(pass, q, get_priv_data(priv)) == 0; // syslog(LOG_AUTHPRIV|LOG_DEBUG, "user=%s, rc=%d",p,rc); break; } diff --git a/src/vmod_basicauth.vcc b/src/vmod_basicauth.vcc index cda0d66..1145c40 100644 --- a/src/vmod_basicauth.vcc +++ b/src/vmod_basicauth.vcc @@ -1,5 +1,5 @@ # This file is part of vmod-basicauth -# Copyright (C) 2013-2014 Sergey Poznyakoff +# Copyright (C) 2013-2016 Sergey Poznyakoff # # Vmod-basicauth is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,8 +29,7 @@ the password file created using the **htpasswd** command. Four kinds of password hashes are supported: Apache MD5, crypt, SHA1, and plaintext. -$Init init_function -$Function BOOL match(PRIV_VCL, STRING, STRING) +$Function BOOL match(PRIV_TASK, STRING, STRING) Description The **match** function returns **TRUE** or **FALSE** depending on whether diff --git a/tests/Makefile.am b/tests/Makefile.am index 700c8c6..4649e95 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,5 @@ # This file is part of vmod-basicauth -# Copyright (C) 2013-2014 Sergey Poznyakoff +# Copyright (C) 2013-2016 Sergey Poznyakoff # # Vmod-basicauth is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ VMOD_TESTS = \ EXTRA_DIST=$(VMOD_TESTS) htpasswd check: - cd $(abs_srcdir); \ + $(AM_V_at)cd $(abs_srcdir); \ for t in $(VMOD_TESTS); do \ $(VARNISHSRC)/bin/varnishtest/varnishtest \ -Dvarnishd=$(VARNISHSRC)/bin/varnishd/varnishd \ |