Go to the source code of this file.
◆ pq_verify_peer_name_matches_certificate()
| bool pq_verify_peer_name_matches_certificate |
( |
PGconn * |
conn | ) |
|
|
extern |
Definition at line 252 of file fe-secure-common.c.
253{
255 int rc;
258
259
260
261
262
264 return true;
265
266
267 if (!(host && host[0] != '\0'))
268 {
270 return false;
271 }
272
274
275 if (rc == 0)
276 {
277
278
279
280
281
282
284 {
286 libpq_ngettext(
"server certificate for \"%s\" (and %d other name) does not match host name \"%s\"",
287 "server certificate for \"%s\" (and %d other names) does not match host name \"%s\"",
291 }
293 {
296 }
297 else
298 {
300 }
301 }
302
303
305
306 return (rc == 1);
307}
int pgtls_verify_peer_name_matches_certificate_guts(PGconn *conn, int *names_examined, char **first_name)
#define libpq_ngettext(s, p, n)
void libpq_append_conn_error(PGconn *conn, const char *fmt,...)
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
void appendPQExpBufferChar(PQExpBuffer str, char ch)
PQExpBufferData errorMessage
References appendPQExpBuffer(), appendPQExpBufferChar(), conn, pg_conn::connhost, pg_conn::errorMessage, fb(), free, pg_conn_host::host, libpq_append_conn_error(), libpq_ngettext, pgtls_verify_peer_name_matches_certificate_guts(), pg_conn::sslmode, and pg_conn::whichhost.
Referenced by open_client_SSL().
◆ pq_verify_peer_name_matches_certificate_ip()
Definition at line 157 of file fe-secure-common.c.
161{
163 int match = 0;
165 int family;
166 char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
168
170
171 if (!(host && host[0] != '\0'))
172 {
174 return -1;
175 }
176
177
178
179
180
181
182
183
185 {
186
188
190
191
192
193
194
195
197 {
199 match = 1;
200 }
201 }
202
203
204
205
206
207#ifdef HAVE_INET_PTON
208 else if (
iplen == 16)
209 {
210
212
214
216 {
218 match = 1;
219 }
220 }
221#endif
222 else
223 {
224
225
226
227
230 return -1;
231 }
232
233
236 {
239 return -1;
240 }
241
243 return match;
244}
#define PG_STRERROR_R_BUFLEN
char * pg_inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size)
int inet_aton(const char *cp, struct in_addr *addr)
References conn, pg_conn::connhost, fb(), pg_conn_host::host, inet_aton(), libpq_append_conn_error(), pg_inet_net_ntop(), PG_STRERROR_R_BUFLEN, strerror_r, and pg_conn::whichhost.
Referenced by openssl_verify_peer_name_matches_certificate_ip().
◆ pq_verify_peer_name_matches_certificate_name()
Definition at line 87 of file fe-secure-common.c.
90{
92 int result;
94
96
97 if (!(host && host[0] != '\0'))
98 {
100 return -1;
101 }
102
103
104
105
106
109 {
111 return -1;
112 }
114 name[namelen] =
'\0';
115
116
117
118
119
121 {
124 return -1;
125 }
126
128 {
129
130 result = 1;
131 }
133 {
134
135 result = 1;
136 }
137 else
138 {
139 result = 0;
140 }
141
143 return result;
144}
static bool wildcard_certificate_match(const char *pattern, const char *string)
int pg_strcasecmp(const char *s1, const char *s2)
References conn, pg_conn::connhost, fb(), free, pg_conn_host::host, libpq_append_conn_error(), malloc, name, pg_strcasecmp(), pg_conn::whichhost, and wildcard_certificate_match().
Referenced by openssl_verify_peer_name_matches_certificate_name().