summaryrefslogtreecommitdiff
path: root/src/backend/libpq
diff options
context:
space:
mode:
authorRobert Haas2016-06-09 22:02:36 +0000
committerRobert Haas2016-06-09 22:02:36 +0000
commit4bc424b968058c7f0aa685821d7039e86faac99c (patch)
treea4e245ae67bd11edb3926ff5fb3b0223438ac283 /src/backend/libpq
parent9164deea2f4ac90ee5e008ff41fc5ad4423887b2 (diff)
pgindent run for 9.6
Diffstat (limited to 'src/backend/libpq')
-rw-r--r--src/backend/libpq/auth.c25
-rw-r--r--src/backend/libpq/be-secure-openssl.c22
-rw-r--r--src/backend/libpq/be-secure.c24
-rw-r--r--src/backend/libpq/pqcomm.c2
-rw-r--r--src/backend/libpq/pqmq.c6
5 files changed, 41 insertions, 38 deletions
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index 43bb1343550..7d8fc3e54d0 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -1875,7 +1875,7 @@ CheckPAMAuth(Port *port, char *user, char *password)
retval = pg_getnameinfo_all(&port->raddr.addr, port->raddr.salen,
hostinfo, sizeof(hostinfo), NULL, 0,
- port->hba->pam_use_hostname ? 0 : NI_NUMERICHOST | NI_NUMERICSERV);
+ port->hba->pam_use_hostname ? 0 : NI_NUMERICHOST | NI_NUMERICSERV);
if (retval != 0)
{
ereport(WARNING,
@@ -1934,7 +1934,7 @@ CheckPAMAuth(Port *port, char *user, char *password)
{
ereport(LOG,
(errmsg("pam_set_item(PAM_RHOST) failed: %s",
- pam_strerror(pamh, retval))));
+ pam_strerror(pamh, retval))));
pam_passwd = NULL;
return STATUS_ERROR;
}
@@ -1996,8 +1996,8 @@ CheckPAMAuth(Port *port, char *user, char *password)
static int
CheckBSDAuth(Port *port, char *user)
{
- char *passwd;
- int retval;
+ char *passwd;
+ int retval;
/* Send regular password request to client, and get the response */
sendAuthRequest(port, AUTH_REQ_PASSWORD);
@@ -2539,11 +2539,10 @@ CheckRADIUSAuth(Port *port)
radius_add_attribute(packet, RADIUS_NAS_IDENTIFIER, (unsigned char *) identifier, strlen(identifier));
/*
- * RADIUS password attributes are calculated as:
- * e[0] = p[0] XOR MD5(secret + Request Authenticator)
- * for the first group of 16 octets, and then:
- * e[i] = p[i] XOR MD5(secret + e[i-1])
- * for the following ones (if necessary)
+ * RADIUS password attributes are calculated as: e[0] = p[0] XOR
+ * MD5(secret + Request Authenticator) for the first group of 16 octets,
+ * and then: e[i] = p[i] XOR MD5(secret + e[i-1]) for the following ones
+ * (if necessary)
*/
encryptedpasswordlen = ((strlen(passwd) + RADIUS_VECTOR_LENGTH - 1) / RADIUS_VECTOR_LENGTH) * RADIUS_VECTOR_LENGTH;
cryptvector = palloc(strlen(port->hba->radiussecret) + RADIUS_VECTOR_LENGTH);
@@ -2554,7 +2553,11 @@ CheckRADIUSAuth(Port *port)
for (i = 0; i < encryptedpasswordlen; i += RADIUS_VECTOR_LENGTH)
{
memcpy(cryptvector + strlen(port->hba->radiussecret), md5trailer, RADIUS_VECTOR_LENGTH);
- /* .. and for subsequent iterations the result of the previous XOR (calculated below) */
+
+ /*
+ * .. and for subsequent iterations the result of the previous XOR
+ * (calculated below)
+ */
md5trailer = encryptedpassword + i;
if (!pg_md5_binary(cryptvector, strlen(port->hba->radiussecret) + RADIUS_VECTOR_LENGTH, encryptedpassword + i))
@@ -2565,7 +2568,7 @@ CheckRADIUSAuth(Port *port)
return STATUS_ERROR;
}
- for (j = i; j < i+RADIUS_VECTOR_LENGTH; j++)
+ for (j = i; j < i + RADIUS_VECTOR_LENGTH; j++)
{
if (j < strlen(passwd))
encryptedpassword[j] = passwd[j] ^ encryptedpassword[j];
diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c
index 95cceeed7ad..f6adb155c6e 100644
--- a/src/backend/libpq/be-secure-openssl.c
+++ b/src/backend/libpq/be-secure-openssl.c
@@ -241,8 +241,8 @@ be_tls_init(void)
(buf.st_uid == 0 && buf.st_mode & (S_IWGRP | S_IXGRP | S_IRWXO)))
ereport(FATAL,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
- errmsg("private key file \"%s\" has group or world access",
- ssl_key_file),
+ errmsg("private key file \"%s\" has group or world access",
+ ssl_key_file),
errdetail("File must have permissions u=rw (0600) or less if owned by the database user, or permissions u=rw,g=r (0640) or less if owned by root.")));
#endif
@@ -316,7 +316,7 @@ be_tls_init(void)
else
ereport(FATAL,
(errmsg("could not load SSL certificate revocation list file \"%s\": %s",
- ssl_crl_file, SSLerrmessage(ERR_get_error()))));
+ ssl_crl_file, SSLerrmessage(ERR_get_error()))));
}
}
@@ -377,11 +377,12 @@ be_tls_open_server(Port *port)
port->ssl_in_use = true;
aloop:
+
/*
* Prepare to call SSL_get_error() by clearing thread's OpenSSL error
* queue. In general, the current thread's error queue must be empty
- * before the TLS/SSL I/O operation is attempted, or SSL_get_error()
- * will not work reliably. An extension may have failed to clear the
+ * before the TLS/SSL I/O operation is attempted, or SSL_get_error() will
+ * not work reliably. An extension may have failed to clear the
* per-thread error queue following another call to an OpenSSL I/O
* routine.
*/
@@ -393,12 +394,11 @@ aloop:
/*
* Other clients of OpenSSL in the backend may fail to call
- * ERR_get_error(), but we always do, so as to not cause problems
- * for OpenSSL clients that don't call ERR_clear_error()
- * defensively. Be sure that this happens by calling now.
- * SSL_get_error() relies on the OpenSSL per-thread error queue
- * being intact, so this is the earliest possible point
- * ERR_get_error() may be called.
+ * ERR_get_error(), but we always do, so as to not cause problems for
+ * OpenSSL clients that don't call ERR_clear_error() defensively. Be
+ * sure that this happens by calling now. SSL_get_error() relies on
+ * the OpenSSL per-thread error queue being intact, so this is the
+ * earliest possible point ERR_get_error() may be called.
*/
ecode = ERR_get_error();
switch (err)
diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c
index 29297e72999..cdd07d577b0 100644
--- a/src/backend/libpq/be-secure.c
+++ b/src/backend/libpq/be-secure.c
@@ -140,26 +140,26 @@ retry:
/* In blocking mode, wait until the socket is ready */
if (n < 0 && !port->noblock && (errno == EWOULDBLOCK || errno == EAGAIN))
{
- WaitEvent event;
+ WaitEvent event;
Assert(waitfor);
ModifyWaitEvent(FeBeWaitSet, 0, waitfor, NULL);
- WaitEventSetWait(FeBeWaitSet, -1 /* no timeout */, &event, 1);
+ WaitEventSetWait(FeBeWaitSet, -1 /* no timeout */ , &event, 1);
/*
* If the postmaster has died, it's not safe to continue running,
* because it is the postmaster's job to kill us if some other backend
* exists uncleanly. Moreover, we won't run very well in this state;
* helper processes like walwriter and the bgwriter will exit, so
- * performance may be poor. Finally, if we don't exit, pg_ctl will
- * be unable to restart the postmaster without manual intervention,
- * so no new connections can be accepted. Exiting clears the deck
- * for a postmaster restart.
+ * performance may be poor. Finally, if we don't exit, pg_ctl will be
+ * unable to restart the postmaster without manual intervention, so no
+ * new connections can be accepted. Exiting clears the deck for a
+ * postmaster restart.
*
- * (Note that we only make this check when we would otherwise sleep
- * on our latch. We might still continue running for a while if the
+ * (Note that we only make this check when we would otherwise sleep on
+ * our latch. We might still continue running for a while if the
* postmaster is killed in mid-query, or even through multiple queries
* if we never have to wait for read. We don't want to burn too many
* cycles checking for this very rare condition, and this should cause
@@ -168,7 +168,7 @@ retry:
if (event.events & WL_POSTMASTER_DEATH)
ereport(FATAL,
(errcode(ERRCODE_ADMIN_SHUTDOWN),
- errmsg("terminating connection due to unexpected postmaster exit")));
+ errmsg("terminating connection due to unexpected postmaster exit")));
/* Handle interrupt. */
if (event.events & WL_LATCH_SET)
@@ -241,19 +241,19 @@ retry:
if (n < 0 && !port->noblock && (errno == EWOULDBLOCK || errno == EAGAIN))
{
- WaitEvent event;
+ WaitEvent event;
Assert(waitfor);
ModifyWaitEvent(FeBeWaitSet, 0, waitfor, NULL);
- WaitEventSetWait(FeBeWaitSet, -1 /* no timeout */, &event, 1);
+ WaitEventSetWait(FeBeWaitSet, -1 /* no timeout */ , &event, 1);
/* See comments in secure_read. */
if (event.events & WL_POSTMASTER_DEATH)
ereport(FATAL,
(errcode(ERRCODE_ADMIN_SHUTDOWN),
- errmsg("terminating connection due to unexpected postmaster exit")));
+ errmsg("terminating connection due to unexpected postmaster exit")));
/* Handle interrupt. */
if (event.events & WL_LATCH_SET)
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index 8d6eb0b7bbf..ba42753c067 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -1174,7 +1174,7 @@ pq_startmsgread(void)
if (PqCommReadingMsg)
ereport(FATAL,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
- errmsg("terminating connection because protocol synchronization was lost")));
+ errmsg("terminating connection because protocol synchronization was lost")));
PqCommReadingMsg = true;
}
diff --git a/src/backend/libpq/pqmq.c b/src/backend/libpq/pqmq.c
index 350210b0064..3225c1fa0e7 100644
--- a/src/backend/libpq/pqmq.c
+++ b/src/backend/libpq/pqmq.c
@@ -143,9 +143,9 @@ mq_putmessage(char msgtype, const char *s, size_t len)
/*
* If the message queue is already gone, just ignore the message. This
- * doesn't necessarily indicate a problem; for example, DEBUG messages
- * can be generated late in the shutdown sequence, after all DSMs have
- * already been detached.
+ * doesn't necessarily indicate a problem; for example, DEBUG messages can
+ * be generated late in the shutdown sequence, after all DSMs have already
+ * been detached.
*/
if (pq_mq == NULL)
return 0;