aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2020-02-12 03:50:47 +0000
committerNIIBE Yutaka <[email protected]>2020-02-12 03:50:47 +0000
commitece1764c12b7aaf6351c9bb9ae3bf1d221a6af01 (patch)
tree6dc0d52136508690f3308bc20c30d450d07fd383
parentregexp: A little fix for jimregexp.c. (diff)
downloadgnupg-ece1764c12b7aaf6351c9bb9ae3bf1d221a6af01.tar.gz
gnupg-ece1764c12b7aaf6351c9bb9ae3bf1d221a6af01.zip
regexp: Fix use of regexp in g10/trustdb.c.
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--configure.ac6
-rw-r--r--g10/trustdb.c22
2 files changed, 2 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac
index 4b4aa7ab8..9cf0ddce2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1479,12 +1479,6 @@ AC_CHECK_FUNCS([getpeerucred])
#
GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
-#
-# Define for regexp support
-#
-AC_DEFINE(DISABLE_REGEX,0, [Define to disable regular expression support])
-
-
#
# Do we have zlib? Must do it here because Solaris failed
diff --git a/g10/trustdb.c b/g10/trustdb.c
index 64e6ec349..8541cbebc 100644
--- a/g10/trustdb.c
+++ b/g10/trustdb.c
@@ -23,14 +23,10 @@
#include <stdlib.h>
#include <string.h>
-#ifndef DISABLE_REGEX
-#include <sys/types.h>
-#include <regex.h>
-#endif /* !DISABLE_REGEX */
-
#include "gpg.h"
#include "../common/status.h"
#include "../common/iobuf.h"
+#include "../regexp/jimregexp.h"
#include "keydb.h"
#include "../common/util.h"
#include "options.h"
@@ -1507,7 +1503,6 @@ store_validation_status (ctrl_t ctrl, int depth,
/* Returns a sanitized copy of the regexp (which might be "", but not
NULL). */
-#ifndef DISABLE_REGEX
/* Operator characters except '.' and backslash.
See regex(7) on BSD. */
#define REGEXP_OPERATOR_CHARS "^[$()|*+?{"
@@ -1572,7 +1567,6 @@ sanitize_regexp(const char *old)
return new;
}
-#endif /*!DISABLE_REGEX*/
/* Used by validate_one_keyblock to confirm a regexp within a trust
signature. Returns 1 for match, and 0 for no match or regex
@@ -1580,25 +1574,15 @@ sanitize_regexp(const char *old)
static int
check_regexp(const char *expr,const char *string)
{
-#ifdef DISABLE_REGEX
- (void)expr;
- (void)string;
- /* When DISABLE_REGEX is defined, assume all regexps do not
- match. */
- return 0;
-#else
int ret;
char *regexp;
regexp=sanitize_regexp(expr);
-#ifdef __riscos__
- ret=riscos_check_regexp(expr, string, DBG_TRUST);
-#else
{
regex_t pat;
- ret=regcomp(&pat,regexp,REG_ICASE|REG_NOSUB|REG_EXTENDED);
+ ret=regcomp(&pat,regexp,REG_ICASE|REG_EXTENDED);
if(ret==0)
{
ret=regexec(&pat,string,0,NULL,0);
@@ -1606,7 +1590,6 @@ check_regexp(const char *expr,const char *string)
}
ret=(ret==0);
}
-#endif
if(DBG_TRUST)
log_debug("regexp '%s' ('%s') on '%s': %s\n",
@@ -1615,7 +1598,6 @@ check_regexp(const char *expr,const char *string)
xfree(regexp);
return ret;
-#endif
}
/*