mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
Added decoder for HTML-encoded and URL-encoded passwords and usernames.
This prevents special characters from not being recognized. Reported by P.H.Vos. Also updated gnulib and added c-strncasecmp
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --lgpl=2 --no-conditional-dependencies --no-libtool --macro-prefix=gl c-ctype cloexec getline getpass memmem minmax
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --lgpl=2 --no-conditional-dependencies --no-libtool --macro-prefix=gl c-ctype c-strcase cloexec getline getpass memmem minmax
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.9.6 gnits
|
||||
|
||||
@@ -55,6 +55,12 @@ libgnu_a_SOURCES += c-ctype.h c-ctype.c
|
||||
|
||||
## end gnulib module c-ctype
|
||||
|
||||
## begin gnulib module c-strcase
|
||||
|
||||
libgnu_a_SOURCES += c-strcase.h c-strcasecmp.c c-strncasecmp.c
|
||||
|
||||
## end gnulib module c-strcase
|
||||
|
||||
## begin gnulib module cloexec
|
||||
|
||||
libgnu_a_SOURCES += cloexec.c
|
||||
|
||||
@@ -136,7 +136,8 @@ extern int c_tolower (int c) _GL_ATTRIBUTE_CONST;
|
||||
extern int c_toupper (int c) _GL_ATTRIBUTE_CONST;
|
||||
|
||||
|
||||
#if defined __GNUC__ && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS
|
||||
#if (defined __GNUC__ && !defined __STRICT_ANSI__ && defined __OPTIMIZE__ \
|
||||
&& !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS)
|
||||
|
||||
/* ASCII optimizations. */
|
||||
|
||||
|
||||
56
gl/c-strcase.h
Normal file
56
gl/c-strcase.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* Case-insensitive string comparison functions in C locale.
|
||||
Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2013 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1, 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef C_STRCASE_H
|
||||
#define C_STRCASE_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
/* The functions defined in this file assume the "C" locale and a character
|
||||
set without diacritics (ASCII-US or EBCDIC-US or something like that).
|
||||
Even if the "C" locale on a particular system is an extension of the ASCII
|
||||
character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it
|
||||
is ISO-8859-1), the functions in this file recognize only the ASCII
|
||||
characters. More precisely, one of the string arguments must be an ASCII
|
||||
string; the other one can also contain non-ASCII characters (but then
|
||||
the comparison result will be nonzero). */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
|
||||
greater than zero if S1 is lexicographically less than, equal to or greater
|
||||
than S2. */
|
||||
extern int c_strcasecmp (const char *s1, const char *s2) _GL_ATTRIBUTE_PURE;
|
||||
|
||||
/* Compare no more than N characters of strings S1 and S2, ignoring case,
|
||||
returning less than, equal to or greater than zero if S1 is
|
||||
lexicographically less than, equal to or greater than S2. */
|
||||
extern int c_strncasecmp (const char *s1, const char *s2, size_t n)
|
||||
_GL_ATTRIBUTE_PURE;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* C_STRCASE_H */
|
||||
56
gl/c-strcasecmp.c
Normal file
56
gl/c-strcasecmp.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/* c-strcasecmp.c -- case insensitive string comparator in C locale
|
||||
Copyright (C) 1998-1999, 2005-2006, 2009-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1, 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "c-strcase.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "c-ctype.h"
|
||||
|
||||
int
|
||||
c_strcasecmp (const char *s1, const char *s2)
|
||||
{
|
||||
register const unsigned char *p1 = (const unsigned char *) s1;
|
||||
register const unsigned char *p2 = (const unsigned char *) s2;
|
||||
unsigned char c1, c2;
|
||||
|
||||
if (p1 == p2)
|
||||
return 0;
|
||||
|
||||
do
|
||||
{
|
||||
c1 = c_tolower (*p1);
|
||||
c2 = c_tolower (*p2);
|
||||
|
||||
if (c1 == '\0')
|
||||
break;
|
||||
|
||||
++p1;
|
||||
++p2;
|
||||
}
|
||||
while (c1 == c2);
|
||||
|
||||
if (UCHAR_MAX <= INT_MAX)
|
||||
return c1 - c2;
|
||||
else
|
||||
/* On machines where 'char' and 'int' are types of the same size, the
|
||||
difference of two 'unsigned char' values - including the sign bit -
|
||||
doesn't fit in an 'int'. */
|
||||
return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
|
||||
}
|
||||
56
gl/c-strncasecmp.c
Normal file
56
gl/c-strncasecmp.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/* c-strncasecmp.c -- case insensitive string comparator in C locale
|
||||
Copyright (C) 1998-1999, 2005-2006, 2009-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1, 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "c-strcase.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "c-ctype.h"
|
||||
|
||||
int
|
||||
c_strncasecmp (const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
register const unsigned char *p1 = (const unsigned char *) s1;
|
||||
register const unsigned char *p2 = (const unsigned char *) s2;
|
||||
unsigned char c1, c2;
|
||||
|
||||
if (p1 == p2 || n == 0)
|
||||
return 0;
|
||||
|
||||
do
|
||||
{
|
||||
c1 = c_tolower (*p1);
|
||||
c2 = c_tolower (*p2);
|
||||
|
||||
if (--n == 0 || c1 == '\0')
|
||||
break;
|
||||
|
||||
++p1;
|
||||
++p2;
|
||||
}
|
||||
while (c1 == c2);
|
||||
|
||||
if (UCHAR_MAX <= INT_MAX)
|
||||
return c1 - c2;
|
||||
else
|
||||
/* On machines where 'char' and 'int' are types of the same size, the
|
||||
difference of two 'unsigned char' values - including the sign bit -
|
||||
doesn't fit in an 'int'. */
|
||||
return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
|
||||
}
|
||||
10
gl/fseeko.c
10
gl/fseeko.c
@@ -19,7 +19,7 @@
|
||||
/* Specification. */
|
||||
#include <stdio.h>
|
||||
|
||||
/* Get off_t and lseek. */
|
||||
/* Get off_t, lseek, _POSIX_VERSION. */
|
||||
#include <unistd.h>
|
||||
|
||||
#include "stdio-impl.h"
|
||||
@@ -99,8 +99,14 @@ fseeko (FILE *fp, off_t offset, int whence)
|
||||
#elif defined EPLAN9 /* Plan9 */
|
||||
if (fp->rp == fp->buf
|
||||
&& fp->wp == fp->buf)
|
||||
#elif FUNC_FFLUSH_STDIN < 0 && 200809 <= _POSIX_VERSION
|
||||
/* Cross-compiling to some other system advertising conformance to
|
||||
POSIX.1-2008 or later. Assume fseeko and fflush work as advertised.
|
||||
If this assumption is incorrect, please report the bug to
|
||||
bug-gnulib. */
|
||||
if (0)
|
||||
#else
|
||||
#error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib."
|
||||
#error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
|
||||
#endif
|
||||
{
|
||||
/* We get here when an fflush() call immediately preceded this one (or
|
||||
|
||||
@@ -8,15 +8,7 @@ dnl with or without modifications, as long as this notice is preserved.
|
||||
AC_DEFUN([gl_EXTERN_INLINE],
|
||||
[
|
||||
AH_VERBATIM([extern_inline],
|
||||
[/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'.
|
||||
_GL_EXTERN_INLINE is a portable alternative to 'extern inline'.
|
||||
_GL_INLINE_HEADER_BEGIN contains useful stuff to put
|
||||
in an include file, before uses of _GL_INLINE.
|
||||
It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic,
|
||||
when FOO is an inline function in the header; see
|
||||
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>.
|
||||
_GL_INLINE_HEADER_END contains useful stuff to put
|
||||
in the same include file, after uses of _GL_INLINE.
|
||||
[/* Please see the Gnulib manual for how to use these macros.
|
||||
|
||||
Suppress extern inline with HP-UX cc, as it appears to be broken; see
|
||||
<http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
|
||||
@@ -39,7 +31,8 @@ AC_DEFUN([gl_EXTERN_INLINE],
|
||||
&& !defined __APPLE__)
|
||||
# define _GL_INLINE inline
|
||||
# define _GL_EXTERN_INLINE extern inline
|
||||
#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __APPLE__
|
||||
#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
|
||||
&& !defined __APPLE__)
|
||||
# if __GNUC_GNU_INLINE__
|
||||
/* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
|
||||
# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
|
||||
@@ -59,6 +52,10 @@ AC_DEFUN([gl_EXTERN_INLINE],
|
||||
# define _GL_INLINE_HEADER_CONST_PRAGMA \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
|
||||
# endif
|
||||
/* Suppress GCC's bogus "no previous prototype for 'FOO'"
|
||||
and "no previous declaration for 'FOO'" diagnostics,
|
||||
when FOO is an inline function in the header; see
|
||||
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */
|
||||
# define _GL_INLINE_HEADER_BEGIN \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# fseeko.m4 serial 16
|
||||
# fseeko.m4 serial 17
|
||||
dnl Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
@@ -37,7 +37,7 @@ AC_DEFUN([gl_FUNC_FSEEKO],
|
||||
fi
|
||||
m4_ifdef([gl_FUNC_FFLUSH_STDIN], [
|
||||
gl_FUNC_FFLUSH_STDIN
|
||||
if test $gl_cv_func_fflush_stdin = no; then
|
||||
if test $gl_cv_func_fflush_stdin != yes; then
|
||||
REPLACE_FSEEKO=1
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -27,12 +27,13 @@
|
||||
|
||||
|
||||
# Specification in the form of a command-line invocation:
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --lgpl=2 --no-conditional-dependencies --no-libtool --macro-prefix=gl c-ctype cloexec getline getpass memmem minmax
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --lgpl=2 --no-conditional-dependencies --no-libtool --macro-prefix=gl c-ctype c-strcase cloexec getline getpass memmem minmax
|
||||
|
||||
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
||||
gl_LOCAL_DIR([])
|
||||
gl_MODULES([
|
||||
c-ctype
|
||||
c-strcase
|
||||
cloexec
|
||||
getline
|
||||
getpass
|
||||
|
||||
@@ -39,6 +39,7 @@ AC_DEFUN([gl_EARLY],
|
||||
m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
|
||||
AC_REQUIRE([gl_PROG_AR_RANLIB])
|
||||
# Code from module c-ctype:
|
||||
# Code from module c-strcase:
|
||||
# Code from module cloexec:
|
||||
# Code from module close:
|
||||
# Code from module dup2:
|
||||
@@ -370,6 +371,9 @@ AC_DEFUN([gl_FILE_LIST], [
|
||||
build-aux/snippet/warn-on-use.h
|
||||
lib/c-ctype.c
|
||||
lib/c-ctype.h
|
||||
lib/c-strcase.h
|
||||
lib/c-strcasecmp.c
|
||||
lib/c-strncasecmp.c
|
||||
lib/cloexec.c
|
||||
lib/cloexec.h
|
||||
lib/close.c
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
|
||||
|
||||
static void cdecl
|
||||
static void __cdecl
|
||||
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
|
||||
const wchar_t *function,
|
||||
const wchar_t *file,
|
||||
@@ -45,7 +45,7 @@ gl_msvc_invalid_parameter_handler (const wchar_t *expression,
|
||||
|
||||
# if defined _MSC_VER
|
||||
|
||||
static void cdecl
|
||||
static void __cdecl
|
||||
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
|
||||
const wchar_t *function,
|
||||
const wchar_t *file,
|
||||
@@ -94,7 +94,7 @@ gl_msvc_inval_current (void)
|
||||
}
|
||||
}
|
||||
|
||||
static void cdecl
|
||||
static void __cdecl
|
||||
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
|
||||
const wchar_t *function,
|
||||
const wchar_t *file,
|
||||
|
||||
Reference in New Issue
Block a user