mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03:00
pgindent run for 9.5
This commit is contained in:
@ -291,7 +291,8 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
|
||||
date ddres;
|
||||
timestamp tres;
|
||||
interval *ires;
|
||||
char *endptr, endchar;
|
||||
char *endptr,
|
||||
endchar;
|
||||
|
||||
case ECPGt_short:
|
||||
case ECPGt_int:
|
||||
|
@ -499,9 +499,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
|
||||
char *newcopy = NULL;
|
||||
|
||||
/*
|
||||
* arrays are not possible unless the column is an array, too
|
||||
* FIXME: we do not know if the column is an array here
|
||||
* array input to singleton column will result in a runtime error
|
||||
* arrays are not possible unless the column is an array, too FIXME: we do
|
||||
* not know if the column is an array here array input to singleton column
|
||||
* will result in a runtime error
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -852,7 +852,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
|
||||
mallocedval = ecpg_strdup("", lineno);
|
||||
|
||||
if (!mallocedval)
|
||||
return false;
|
||||
return false;
|
||||
|
||||
for (element = 0; element < asize; element++)
|
||||
{
|
||||
@ -915,7 +915,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
|
||||
mallocedval = ecpg_strdup("", lineno);
|
||||
|
||||
if (!mallocedval)
|
||||
return false;
|
||||
return false;
|
||||
|
||||
for (element = 0; element < asize; element++)
|
||||
{
|
||||
@ -962,7 +962,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
|
||||
mallocedval = ecpg_strdup("", lineno);
|
||||
|
||||
if (!mallocedval)
|
||||
return false;
|
||||
return false;
|
||||
|
||||
for (element = 0; element < asize; element++)
|
||||
{
|
||||
@ -1009,7 +1009,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
|
||||
mallocedval = ecpg_strdup("", lineno);
|
||||
|
||||
if (!mallocedval)
|
||||
return false;
|
||||
return false;
|
||||
|
||||
for (element = 0; element < asize; element++)
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ static struct auto_mem *auto_allocs = NULL;
|
||||
char *
|
||||
ecpg_auto_alloc(long size, int lineno)
|
||||
{
|
||||
void *ptr = (void *) ecpg_alloc(size, lineno);
|
||||
void *ptr = (void *) ecpg_alloc(size, lineno);
|
||||
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
|
@ -42,17 +42,16 @@ my %replace_token = (
|
||||
|
||||
# or in the block
|
||||
my %replace_string = (
|
||||
'NOT_LA' => 'not',
|
||||
'NULLS_LA' => 'nulls',
|
||||
'WITH_LA' => 'with',
|
||||
'TYPECAST' => '::',
|
||||
'DOT_DOT' => '..',
|
||||
'COLON_EQUALS' => ':=',
|
||||
'EQUALS_GREATER' => '=>',
|
||||
'LESS_EQUALS' => '<=',
|
||||
'GREATER_EQUALS' => '>=',
|
||||
'NOT_EQUALS' => '<>',
|
||||
);
|
||||
'NOT_LA' => 'not',
|
||||
'NULLS_LA' => 'nulls',
|
||||
'WITH_LA' => 'with',
|
||||
'TYPECAST' => '::',
|
||||
'DOT_DOT' => '..',
|
||||
'COLON_EQUALS' => ':=',
|
||||
'EQUALS_GREATER' => '=>',
|
||||
'LESS_EQUALS' => '<=',
|
||||
'GREATER_EQUALS' => '>=',
|
||||
'NOT_EQUALS' => '<>',);
|
||||
|
||||
# specific replace_types for specific non-terminals - never include the ':'
|
||||
# ECPG-only replace_types are defined in ecpg-replace_types
|
||||
|
@ -2011,7 +2011,7 @@ keep_going: /* We will come back to here until there is
|
||||
appendPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("could not look up local user ID %d: %s\n"),
|
||||
(int) uid,
|
||||
pqStrerror(passerr, sebuf, sizeof(sebuf)));
|
||||
pqStrerror(passerr, sebuf, sizeof(sebuf)));
|
||||
else
|
||||
appendPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("local user with ID %d does not exist\n"),
|
||||
@ -3845,7 +3845,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options,
|
||||
if (!options[i].val)
|
||||
{
|
||||
printfPQExpBuffer(errorMessage,
|
||||
libpq_gettext("out of memory\n"));
|
||||
libpq_gettext("out of memory\n"));
|
||||
free(result);
|
||||
return 3;
|
||||
}
|
||||
@ -4085,7 +4085,7 @@ parseServiceFile(const char *serviceFile,
|
||||
if (!options[i].val)
|
||||
{
|
||||
printfPQExpBuffer(errorMessage,
|
||||
libpq_gettext("out of memory\n"));
|
||||
libpq_gettext("out of memory\n"));
|
||||
fclose(f);
|
||||
return 3;
|
||||
}
|
||||
@ -4516,7 +4516,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values,
|
||||
if (!options[k].val)
|
||||
{
|
||||
printfPQExpBuffer(errorMessage,
|
||||
libpq_gettext("out of memory\n"));
|
||||
libpq_gettext("out of memory\n"));
|
||||
PQconninfoFree(options);
|
||||
PQconninfoFree(dbname_options);
|
||||
return NULL;
|
||||
@ -4526,6 +4526,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Forget the parsed connection string, so that any subsequent
|
||||
* dbname parameters will not be expanded.
|
||||
@ -5018,7 +5019,7 @@ conninfo_uri_parse_params(char *params,
|
||||
/* Insert generic message if conninfo_storeval didn't give one. */
|
||||
if (errorMessage->len == 0)
|
||||
printfPQExpBuffer(errorMessage,
|
||||
libpq_gettext("invalid URI query parameter: \"%s\"\n"),
|
||||
libpq_gettext("invalid URI query parameter: \"%s\"\n"),
|
||||
keyword);
|
||||
/* And fail. */
|
||||
if (malloced)
|
||||
|
@ -744,10 +744,10 @@ retry3:
|
||||
* the file selected for reading already.
|
||||
*
|
||||
* In SSL mode it's even worse: SSL_read() could say WANT_READ and then
|
||||
* data could arrive before we make the pqReadReady() test, but the
|
||||
* second SSL_read() could still say WANT_READ because the data received
|
||||
* was not a complete SSL record. So we must play dumb and assume there
|
||||
* is more data, relying on the SSL layer to detect true EOF.
|
||||
* data could arrive before we make the pqReadReady() test, but the second
|
||||
* SSL_read() could still say WANT_READ because the data received was not
|
||||
* a complete SSL record. So we must play dumb and assume there is more
|
||||
* data, relying on the SSL layer to detect true EOF.
|
||||
*/
|
||||
|
||||
#ifdef USE_SSL
|
||||
@ -916,9 +916,9 @@ pqSendSome(PGconn *conn, int len)
|
||||
* might not arrive until after we've gone to sleep. Therefore,
|
||||
* we wait for either read ready or write ready.
|
||||
*
|
||||
* In non-blocking mode, we don't wait here directly, but return
|
||||
* 1 to indicate that data is still pending. The caller should
|
||||
* wait for both read and write ready conditions, and call
|
||||
* In non-blocking mode, we don't wait here directly, but return 1
|
||||
* to indicate that data is still pending. The caller should wait
|
||||
* for both read and write ready conditions, and call
|
||||
* PQconsumeInput() on read ready, but just in case it doesn't, we
|
||||
* call pqReadData() ourselves before returning. That's not
|
||||
* enough if the data has not arrived yet, but it's the best we
|
||||
|
@ -64,19 +64,19 @@
|
||||
|
||||
static bool verify_peer_name_matches_certificate(PGconn *);
|
||||
static int verify_cb(int ok, X509_STORE_CTX *ctx);
|
||||
static int verify_peer_name_matches_certificate_name(PGconn *conn,
|
||||
ASN1_STRING *name,
|
||||
char **store_name);
|
||||
static int verify_peer_name_matches_certificate_name(PGconn *conn,
|
||||
ASN1_STRING *name,
|
||||
char **store_name);
|
||||
static void destroy_ssl_system(void);
|
||||
static int initialize_SSL(PGconn *conn);
|
||||
static PostgresPollingStatusType open_client_SSL(PGconn *);
|
||||
static char *SSLerrmessage(void);
|
||||
static void SSLerrfree(char *buf);
|
||||
|
||||
static int my_sock_read(BIO *h, char *buf, int size);
|
||||
static int my_sock_write(BIO *h, const char *buf, int size);
|
||||
static int my_sock_read(BIO *h, char *buf, int size);
|
||||
static int my_sock_write(BIO *h, const char *buf, int size);
|
||||
static BIO_METHOD *my_BIO_s_socket(void);
|
||||
static int my_SSL_set_fd(PGconn *conn, int fd);
|
||||
static int my_SSL_set_fd(PGconn *conn, int fd);
|
||||
|
||||
|
||||
static bool pq_init_ssl_lib = true;
|
||||
@ -187,7 +187,7 @@ pgtls_open_client(PGconn *conn)
|
||||
}
|
||||
|
||||
/*
|
||||
* Is there unread data waiting in the SSL read buffer?
|
||||
* Is there unread data waiting in the SSL read buffer?
|
||||
*/
|
||||
bool
|
||||
pgtls_read_pending(PGconn *conn)
|
||||
@ -221,7 +221,7 @@ rloop:
|
||||
{
|
||||
/* Not supposed to happen, so we don't translate the msg */
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
"SSL_read failed but did not provide error information\n");
|
||||
"SSL_read failed but did not provide error information\n");
|
||||
/* assume the connection is broken */
|
||||
result_errno = ECONNRESET;
|
||||
}
|
||||
@ -247,7 +247,7 @@ rloop:
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext(
|
||||
"server closed the connection unexpectedly\n"
|
||||
"\tThis probably means the server terminated abnormally\n"
|
||||
"\tThis probably means the server terminated abnormally\n"
|
||||
"\tbefore or while processing the request.\n"));
|
||||
else
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
@ -279,12 +279,12 @@ rloop:
|
||||
case SSL_ERROR_ZERO_RETURN:
|
||||
|
||||
/*
|
||||
* Per OpenSSL documentation, this error code is only returned
|
||||
* for a clean connection closure, so we should not report it
|
||||
* as a server crash.
|
||||
* Per OpenSSL documentation, this error code is only returned for
|
||||
* a clean connection closure, so we should not report it as a
|
||||
* server crash.
|
||||
*/
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("SSL connection has been closed unexpectedly\n"));
|
||||
libpq_gettext("SSL connection has been closed unexpectedly\n"));
|
||||
result_errno = ECONNRESET;
|
||||
n = -1;
|
||||
break;
|
||||
@ -329,7 +329,7 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len)
|
||||
{
|
||||
/* Not supposed to happen, so we don't translate the msg */
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
"SSL_write failed but did not provide error information\n");
|
||||
"SSL_write failed but did not provide error information\n");
|
||||
/* assume the connection is broken */
|
||||
result_errno = ECONNRESET;
|
||||
}
|
||||
@ -337,9 +337,8 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len)
|
||||
case SSL_ERROR_WANT_READ:
|
||||
|
||||
/*
|
||||
* Returning 0 here causes caller to wait for write-ready,
|
||||
* which is not really the right thing, but it's the best we
|
||||
* can do.
|
||||
* Returning 0 here causes caller to wait for write-ready, which
|
||||
* is not really the right thing, but it's the best we can do.
|
||||
*/
|
||||
n = 0;
|
||||
break;
|
||||
@ -354,7 +353,7 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len)
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext(
|
||||
"server closed the connection unexpectedly\n"
|
||||
"\tThis probably means the server terminated abnormally\n"
|
||||
"\tThis probably means the server terminated abnormally\n"
|
||||
"\tbefore or while processing the request.\n"));
|
||||
else
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
@ -386,12 +385,12 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len)
|
||||
case SSL_ERROR_ZERO_RETURN:
|
||||
|
||||
/*
|
||||
* Per OpenSSL documentation, this error code is only returned
|
||||
* for a clean connection closure, so we should not report it
|
||||
* as a server crash.
|
||||
* Per OpenSSL documentation, this error code is only returned for
|
||||
* a clean connection closure, so we should not report it as a
|
||||
* server crash.
|
||||
*/
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("SSL connection has been closed unexpectedly\n"));
|
||||
libpq_gettext("SSL connection has been closed unexpectedly\n"));
|
||||
result_errno = ECONNRESET;
|
||||
n = -1;
|
||||
break;
|
||||
@ -509,7 +508,7 @@ verify_peer_name_matches_certificate_name(PGconn *conn, ASN1_STRING *name_entry,
|
||||
if (name_entry == NULL)
|
||||
{
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("SSL certificate's name entry is missing\n"));
|
||||
libpq_gettext("SSL certificate's name entry is missing\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -539,7 +538,7 @@ verify_peer_name_matches_certificate_name(PGconn *conn, ASN1_STRING *name_entry,
|
||||
{
|
||||
free(name);
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("SSL certificate's name contains embedded null\n"));
|
||||
libpq_gettext("SSL certificate's name contains embedded null\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -574,8 +573,9 @@ verify_peer_name_matches_certificate(PGconn *conn)
|
||||
bool found_match = false;
|
||||
bool got_error = false;
|
||||
char *first_name = NULL;
|
||||
|
||||
STACK_OF(GENERAL_NAME) *peer_san;
|
||||
int i;
|
||||
int i;
|
||||
int rc;
|
||||
|
||||
/*
|
||||
@ -614,7 +614,7 @@ verify_peer_name_matches_certificate(PGconn *conn)
|
||||
|
||||
names_examined++;
|
||||
rc = verify_peer_name_matches_certificate_name(conn,
|
||||
name->d.dNSName,
|
||||
name->d.dNSName,
|
||||
&alt_name);
|
||||
if (rc == -1)
|
||||
got_error = true;
|
||||
@ -634,6 +634,7 @@ verify_peer_name_matches_certificate(PGconn *conn)
|
||||
}
|
||||
sk_GENERAL_NAME_free(peer_san);
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is no subjectAltName extension of type dNSName, check the
|
||||
* Common Name.
|
||||
@ -656,10 +657,10 @@ verify_peer_name_matches_certificate(PGconn *conn)
|
||||
{
|
||||
names_examined++;
|
||||
rc = verify_peer_name_matches_certificate_name(
|
||||
conn,
|
||||
X509_NAME_ENTRY_get_data(
|
||||
X509_NAME_get_entry(subject_name, cn_index)),
|
||||
&first_name);
|
||||
conn,
|
||||
X509_NAME_ENTRY_get_data(
|
||||
X509_NAME_get_entry(subject_name, cn_index)),
|
||||
&first_name);
|
||||
|
||||
if (rc == -1)
|
||||
got_error = true;
|
||||
@ -672,10 +673,10 @@ verify_peer_name_matches_certificate(PGconn *conn)
|
||||
if (!found_match && !got_error)
|
||||
{
|
||||
/*
|
||||
* No match. Include the name from the server certificate in the
|
||||
* error message, to aid debugging broken configurations. If there
|
||||
* are multiple names, only print the first one to avoid an overly
|
||||
* long error message.
|
||||
* No match. Include the name from the server certificate in the error
|
||||
* message, to aid debugging broken configurations. If there are
|
||||
* multiple names, only print the first one to avoid an overly long
|
||||
* error message.
|
||||
*/
|
||||
if (names_examined > 1)
|
||||
{
|
||||
@ -806,8 +807,10 @@ pgtls_init(PGconn *conn)
|
||||
|
||||
if (ssl_open_connections++ == 0)
|
||||
{
|
||||
/* These are only required for threaded libcrypto applications, but
|
||||
* make sure we don't stomp on them if they're already set. */
|
||||
/*
|
||||
* These are only required for threaded libcrypto applications,
|
||||
* but make sure we don't stomp on them if they're already set.
|
||||
*/
|
||||
if (CRYPTO_get_id_callback() == NULL)
|
||||
CRYPTO_set_id_callback(pq_threadidcallback);
|
||||
if (CRYPTO_get_locking_callback() == NULL)
|
||||
@ -888,8 +891,10 @@ destroy_ssl_system(void)
|
||||
|
||||
if (pq_init_crypto_lib && ssl_open_connections == 0)
|
||||
{
|
||||
/* No connections left, unregister libcrypto callbacks, if no one
|
||||
* registered different ones in the meantime. */
|
||||
/*
|
||||
* No connections left, unregister libcrypto callbacks, if no one
|
||||
* registered different ones in the meantime.
|
||||
*/
|
||||
if (CRYPTO_get_locking_callback() == pq_lockingcallback)
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
if (CRYPTO_get_id_callback() == pq_threadidcallback)
|
||||
@ -1538,6 +1543,7 @@ PQsslAttributes(PGconn *conn)
|
||||
"protocol",
|
||||
NULL
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1555,7 +1561,7 @@ PQsslAttribute(PGconn *conn, const char *attribute_name)
|
||||
if (strcmp(attribute_name, "key_bits") == 0)
|
||||
{
|
||||
static char sslbits_str[10];
|
||||
int sslbits;
|
||||
int sslbits;
|
||||
|
||||
SSL_get_cipher_bits(conn->ssl, &sslbits);
|
||||
snprintf(sslbits_str, sizeof(sslbits_str), "%d", sslbits);
|
||||
@ -1571,7 +1577,7 @@ PQsslAttribute(PGconn *conn, const char *attribute_name)
|
||||
if (strcmp(attribute_name, "protocol") == 0)
|
||||
return SSL_get_version(conn->ssl);
|
||||
|
||||
return NULL; /* unknown attribute */
|
||||
return NULL; /* unknown attribute */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -251,14 +251,14 @@ pqsecure_raw_read(PGconn *conn, void *ptr, size_t len)
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext(
|
||||
"server closed the connection unexpectedly\n"
|
||||
"\tThis probably means the server terminated abnormally\n"
|
||||
"\tThis probably means the server terminated abnormally\n"
|
||||
"\tbefore or while processing the request.\n"));
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("could not receive data from server: %s\n"),
|
||||
libpq_gettext("could not receive data from server: %s\n"),
|
||||
SOCK_STRERROR(result_errno,
|
||||
sebuf, sizeof(sebuf)));
|
||||
break;
|
||||
@ -323,9 +323,9 @@ retry_masked:
|
||||
result_errno = SOCK_ERRNO;
|
||||
|
||||
/*
|
||||
* If we see an EINVAL, it may be because MSG_NOSIGNAL isn't
|
||||
* available on this machine. So, clear sigpipe_flag so we don't
|
||||
* try the flag again, and retry the send().
|
||||
* If we see an EINVAL, it may be because MSG_NOSIGNAL isn't available
|
||||
* on this machine. So, clear sigpipe_flag so we don't try the flag
|
||||
* again, and retry the send().
|
||||
*/
|
||||
#ifdef MSG_NOSIGNAL
|
||||
if (flags != 0 && result_errno == EINVAL)
|
||||
@ -360,15 +360,15 @@ retry_masked:
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext(
|
||||
"server closed the connection unexpectedly\n"
|
||||
"\tThis probably means the server terminated abnormally\n"
|
||||
"\tThis probably means the server terminated abnormally\n"
|
||||
"\tbefore or while processing the request.\n"));
|
||||
break;
|
||||
|
||||
default:
|
||||
printfPQExpBuffer(&conn->errorMessage,
|
||||
libpq_gettext("could not send data to server: %s\n"),
|
||||
SOCK_STRERROR(result_errno,
|
||||
sebuf, sizeof(sebuf)));
|
||||
SOCK_STRERROR(result_errno,
|
||||
sebuf, sizeof(sebuf)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -411,7 +411,7 @@ PQsslAttribute(PGconn *conn, const char *attribute_name)
|
||||
const char **
|
||||
PQsslAttributes(PGconn *conn)
|
||||
{
|
||||
static const char *result[] = { NULL };
|
||||
static const char *result[] = {NULL};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user