Skip to content

Commit 096992a

Browse files
fix IPv6 hostname parsing (#1004)
1 parent 70f3557 commit 096992a

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

docs/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ __ http://www.quicklisp.org/beta/
6161

6262
When building from sources, you should always build from the current git
6363
HEAD as it's basically the only source that is managed in a way to ensure it
64-
builds aginst current set of dependencies versions.
64+
builds against current set of dependencies versions.
6565

6666
The build system for pgloader uses a Makefile and the Quicklisp Common Lisp
6767
packages distribution system.

src/parsers/command-db-uri.lisp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@
4444
;; password looks like '(":" "password")
4545
(list :user username :password (cadr password)))))
4646

47-
(defun hexdigit-char-p (character)
48-
(member character #. (quote (coerce "0123456789abcdefABCDEF" 'list))))
49-
5047
(defrule ipv4-part (and (digit-char-p character)
5148
(? (digit-char-p character))
5249
(? (digit-char-p character))))
@@ -55,13 +52,13 @@
5552
(:lambda (ipv4)
5653
(list :ipv4 (text ipv4))))
5754

58-
(defrule ipv6 (and #\[ (+ (or (digit-char-p character) ":")) #\])
55+
(defrule ipv6 (and #\[ (+ (or (hexdigit-char-p character) ":")) #\])
5956
(:lambda (ipv6)
6057
(list :ipv6 (text ipv6))))
6158

62-
;;; socket directory is unix only, so we can forbid ":" on the parsing
59+
;; socket directory is unix only, so we can forbid ":" on the parsing
6360
(defun socket-directory-character-p (char)
64-
(or (member char #.(quote (coerce "/.-_" 'list)))
61+
(or (find char "/.-_")
6562
(alphanumericp char)))
6663

6764
(defrule socket-directory (and "unix:"

src/parsers/command-utils.lisp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,7 @@
6565

6666
(defrule comma-separator (and ignore-whitespace #\, ignore-whitespace)
6767
(:constant ","))
68+
69+
;; Predicates for use in rules can only be called with arity 1.
70+
(defun hexdigit-char-p (character)
71+
(digit-char-p character 16))

src/parsers/parse-pgpass.lisp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
(:lambda (c) (second c)))
1616

1717
(defrule pgpass-ipv6-hostname (and #\[
18-
(+ (or (digit-char-p character) ":"))
18+
(+ (or (hexdigit-char-p character) ":"))
1919
#\])
2020
(:lambda (ipv6) (text (second ipv6))))
2121

0 commit comments

Comments
 (0)