Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
e98ca4d3
Commit
e98ca4d3
authored
16 years ago
by
Magnus Hagander
Browse files
Options
Downloads
Patches
Plain Diff
Make hba parsing error messages more specific.
parent
b0169bb1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/libpq/hba.c
+66
-27
66 additions, 27 deletions
src/backend/libpq/hba.c
with
66 additions
and
27 deletions
src/backend/libpq/hba.c
+
66
−
27
View file @
e98ca4d3
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.17
0
2008/10/2
4 12:48:31
mha Exp $
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.17
1
2008/10/2
7 20:04:45
mha Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -637,8 +637,13 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
#ifdef USE_SSL
parsedline
->
conntype
=
ctHostSSL
;
#else
/* We don't accept this keyword at all if no SSL support */
goto
hba_syntax
;
ereport
(
LOG
,
(
errcode
(
ERRCODE_CONFIG_FILE_ERROR
),
errmsg
(
"hostssl not supported on this platform"
),
errhint
(
"compile with --enable-ssl to use SSL connections"
),
errcontext
(
"line %d of configuration file
\"
%s
\"
"
,
line_num
,
HbaFileName
)));
return
false
;
#endif
}
#ifdef USE_SSL
...
...
@@ -654,18 +659,40 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
}
}
/* record type */
else
goto
hba_syntax
;
{
ereport
(
LOG
,
(
errcode
(
ERRCODE_CONFIG_FILE_ERROR
),
errmsg
(
"invalid connection type
\"
%s
\"
"
,
token
),
errcontext
(
"line %d of configuration file
\"
%s
\"
"
,
line_num
,
HbaFileName
)));
return
false
;
}
/* Get the database. */
line_item
=
lnext
(
line_item
);
if
(
!
line_item
)
goto
hba_syntax
;
{
ereport
(
LOG
,
(
errcode
(
ERRCODE_CONFIG_FILE_ERROR
),
errmsg
(
"end-of-line before database specification"
),
errcontext
(
"line %d of configuration file
\"
%s
\"
"
,
line_num
,
HbaFileName
)));
return
false
;
}
parsedline
->
database
=
pstrdup
(
lfirst
(
line_item
));
/* Get the role. */
line_item
=
lnext
(
line_item
);
if
(
!
line_item
)
goto
hba_syntax
;
{
ereport
(
LOG
,
(
errcode
(
ERRCODE_CONFIG_FILE_ERROR
),
errmsg
(
"end-of-line before role specification"
),
errcontext
(
"line %d of configuration file
\"
%s
\"
"
,
line_num
,
HbaFileName
)));
return
false
;
}
parsedline
->
role
=
pstrdup
(
lfirst
(
line_item
));
if
(
parsedline
->
conntype
!=
ctLocal
)
...
...
@@ -673,7 +700,14 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
/* Read the IP address field. (with or without CIDR netmask) */
line_item
=
lnext
(
line_item
);
if
(
!
line_item
)
goto
hba_syntax
;
{
ereport
(
LOG
,
(
errcode
(
ERRCODE_CONFIG_FILE_ERROR
),
errmsg
(
"end-of-line before ip address specification"
),
errcontext
(
"line %d of configuration file
\"
%s
\"
"
,
line_num
,
HbaFileName
)));
return
false
;
}
token
=
pstrdup
(
lfirst
(
line_item
));
/* Check if it has a CIDR suffix and if so isolate it */
...
...
@@ -718,14 +752,29 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
{
if
(
pg_sockaddr_cidr_mask
(
&
parsedline
->
mask
,
cidr_slash
+
1
,
parsedline
->
addr
.
ss_family
)
<
0
)
goto
hba_syntax
;
{
ereport
(
LOG
,
(
errcode
(
ERRCODE_CONFIG_FILE_ERROR
),
errmsg
(
"invalid CIDR mask in address
\"
%s
\"
"
,
token
),
errcontext
(
"line %d of configuration file
\"
%s
\"
"
,
line_num
,
HbaFileName
)));
return
false
;
}
}
else
{
/* Read the mask field. */
line_item
=
lnext
(
line_item
);
if
(
!
line_item
)
goto
hba_syntax
;
{
ereport
(
LOG
,
(
errcode
(
ERRCODE_CONFIG_FILE_ERROR
),
errmsg
(
"end-of-line before netmask specification"
),
errcontext
(
"line %d of configuration file
\"
%s
\"
"
,
line_num
,
HbaFileName
)));
return
false
;
}
token
=
lfirst
(
line_item
);
ret
=
pg_getaddrinfo_all
(
token
,
NULL
,
&
hints
,
&
gai_result
);
...
...
@@ -759,7 +808,14 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
/* Get the authentication method */
line_item
=
lnext
(
line_item
);
if
(
!
line_item
)
goto
hba_syntax
;
{
ereport
(
LOG
,
(
errcode
(
ERRCODE_CONFIG_FILE_ERROR
),
errmsg
(
"end-of-line before authentication method"
),
errcontext
(
"line %d of configuration file
\"
%s
\"
"
,
line_num
,
HbaFileName
)));
return
false
;
}
token
=
lfirst
(
line_item
);
unsupauth
=
NULL
;
...
...
@@ -937,23 +993,6 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
}
return
true
;
hba_syntax:
if
(
line_item
)
ereport
(
LOG
,
(
errcode
(
ERRCODE_CONFIG_FILE_ERROR
),
errmsg
(
"invalid token
\"
%s
\"
"
,
(
char
*
)
lfirst
(
line_item
)),
errcontext
(
"line %d of configuration file
\"
%s
\"
"
,
line_num
,
HbaFileName
)));
else
ereport
(
LOG
,
(
errcode
(
ERRCODE_CONFIG_FILE_ERROR
),
errmsg
(
"missing field at end of line"
),
errcontext
(
"line %d of configuration file
\"
%s
\"
"
,
line_num
,
HbaFileName
)));
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment