|
|
|
@ -781,7 +781,7 @@ PGPing PQping(const char *conninfo); |
|
|
|
|
<listitem> |
|
|
|
|
<para> |
|
|
|
|
<function>PQsetSSLKeyPassHook_OpenSSL</function> lets an application override |
|
|
|
|
<literal>libpq</literal>'s <link linkend="libpq-ssl-clientcert">default |
|
|
|
|
<application>libpq</application>'s <link linkend="libpq-ssl-clientcert">default |
|
|
|
|
handling of encrypted client certificate key files</link> using |
|
|
|
|
<xref linkend="libpq-connect-sslpassword"/> or interactive prompting. |
|
|
|
|
|
|
|
|
@ -793,20 +793,23 @@ void PQsetSSLKeyPassHook_OpenSSL(PQsslKeyPassHook_OpenSSL_type hook); |
|
|
|
|
<programlisting> |
|
|
|
|
int callback_fn(char *buf, int size, PGconn *conn); |
|
|
|
|
</programlisting> |
|
|
|
|
which <literal>libpq</literal> will then call <emphasis>instead of</emphasis> |
|
|
|
|
its default <function>PQdefaultSSLKeyPassHook_OpenSSL</function> handler. The callback |
|
|
|
|
should determine the password for the key and copy it to result-buffer |
|
|
|
|
<literal>buf</literal> of size <literal>size</literal>. The string in <literal> |
|
|
|
|
buf</literal> must be null-terminated. The callback must return the length of |
|
|
|
|
the password stored in <literal>buf</literal> excluding the null terminator. |
|
|
|
|
On failure, the callback should set <literal>buf[0] = '\0'</literal> and return 0. |
|
|
|
|
See <function>PQdefaultSSLKeyPassHook_OpenSSL</function> in <literal>libpq</literal>'s |
|
|
|
|
source code for an example. |
|
|
|
|
</para> |
|
|
|
|
|
|
|
|
|
which <application>libpq</application> will then call |
|
|
|
|
<emphasis>instead of</emphasis> its default |
|
|
|
|
<function>PQdefaultSSLKeyPassHook_OpenSSL</function> handler. The |
|
|
|
|
callback should determine the password for the key and copy it to |
|
|
|
|
result-buffer <parameter>buf</parameter> of size |
|
|
|
|
<parameter>size</parameter>. The string in <parameter>buf</parameter> |
|
|
|
|
must be null-terminated. The callback must return the length of the |
|
|
|
|
password stored in <parameter>buf</parameter> excluding the null |
|
|
|
|
terminator. On failure, the callback should set |
|
|
|
|
<literal>buf[0] = '\0'</literal> and return 0. See |
|
|
|
|
<function>PQdefaultSSLKeyPassHook_OpenSSL</function> in |
|
|
|
|
<application>libpq</application>'s source code for an example. |
|
|
|
|
</para> |
|
|
|
|
|
|
|
|
|
<para> |
|
|
|
|
If the user specified an explicit key location, |
|
|
|
|
its path will be in <literal>conn->pgsslkey</literal> when the callback |
|
|
|
|
its path will be in <literal>conn->sslkey</literal> when the callback |
|
|
|
|
is invoked. This will be empty if the default key path is being used. |
|
|
|
|
For keys that are engine specifiers, it is up to engine implementations |
|
|
|
|
whether they use the OpenSSL password callback or define their own handling. |
|
|
|
|