mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 18:36:12 +02:00
fix IPv6 hostname parsing (#1004)
This commit is contained in:
parent
70f3557670
commit
096992acbc
@ -61,7 +61,7 @@ __ http://www.quicklisp.org/beta/
|
||||
|
||||
When building from sources, you should always build from the current git
|
||||
HEAD as it's basically the only source that is managed in a way to ensure it
|
||||
builds aginst current set of dependencies versions.
|
||||
builds against current set of dependencies versions.
|
||||
|
||||
The build system for pgloader uses a Makefile and the Quicklisp Common Lisp
|
||||
packages distribution system.
|
||||
|
||||
@ -44,9 +44,6 @@
|
||||
;; password looks like '(":" "password")
|
||||
(list :user username :password (cadr password)))))
|
||||
|
||||
(defun hexdigit-char-p (character)
|
||||
(member character #. (quote (coerce "0123456789abcdefABCDEF" 'list))))
|
||||
|
||||
(defrule ipv4-part (and (digit-char-p character)
|
||||
(? (digit-char-p character))
|
||||
(? (digit-char-p character))))
|
||||
@ -55,13 +52,13 @@
|
||||
(:lambda (ipv4)
|
||||
(list :ipv4 (text ipv4))))
|
||||
|
||||
(defrule ipv6 (and #\[ (+ (or (digit-char-p character) ":")) #\])
|
||||
(defrule ipv6 (and #\[ (+ (or (hexdigit-char-p character) ":")) #\])
|
||||
(:lambda (ipv6)
|
||||
(list :ipv6 (text ipv6))))
|
||||
|
||||
;;; socket directory is unix only, so we can forbid ":" on the parsing
|
||||
;; socket directory is unix only, so we can forbid ":" on the parsing
|
||||
(defun socket-directory-character-p (char)
|
||||
(or (member char #.(quote (coerce "/.-_" 'list)))
|
||||
(or (find char "/.-_")
|
||||
(alphanumericp char)))
|
||||
|
||||
(defrule socket-directory (and "unix:"
|
||||
|
||||
@ -65,3 +65,7 @@
|
||||
|
||||
(defrule comma-separator (and ignore-whitespace #\, ignore-whitespace)
|
||||
(:constant ","))
|
||||
|
||||
;; Predicates for use in rules can only be called with arity 1.
|
||||
(defun hexdigit-char-p (character)
|
||||
(digit-char-p character 16))
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
(:lambda (c) (second c)))
|
||||
|
||||
(defrule pgpass-ipv6-hostname (and #\[
|
||||
(+ (or (digit-char-p character) ":"))
|
||||
(+ (or (hexdigit-char-p character) ":"))
|
||||
#\])
|
||||
(:lambda (ipv6) (text (second ipv6))))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user