Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit29a0ccb

Browse files
Revert "Add notBefore and notAfter to SSL cert info display"
Due to an oversight in reviewing, this used functionality notcompatible with old versions of OpenSSL.This reverts commit75ec5e7.
1 parent75ec5e7 commit29a0ccb

File tree

18 files changed

+33
-246
lines changed

18 files changed

+33
-246
lines changed

‎contrib/sslinfo/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ OBJS = \
66
sslinfo.o
77

88
EXTENSION = sslinfo
9-
DATA = sslinfo--1.2--1.3.sql sslinfo--1.2.sql sslinfo--1.1--1.2.sql sslinfo--1.0--1.1.sql
9+
DATA = sslinfo--1.2.sql sslinfo--1.1--1.2.sql sslinfo--1.0--1.1.sql
1010
PGFILEDESC = "sslinfo - information about client SSL certificate"
1111

1212
ifdefUSE_PGXS

‎contrib/sslinfo/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ install_data(
2626
'sslinfo--1.0--1.1.sql',
2727
'sslinfo--1.1--1.2.sql',
2828
'sslinfo--1.2.sql',
29-
'sslinfo--1.2--1.3.sql',
3029
'sslinfo.control',
3130
kwargs: contrib_data_args,
3231
)

‎contrib/sslinfo/sslinfo--1.2--1.3.sql

Lines changed: 0 additions & 12 deletions
This file was deleted.

‎contrib/sslinfo/sslinfo.c

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include"libpq/libpq-be.h"
1919
#include"miscadmin.h"
2020
#include"utils/builtins.h"
21-
#include"utils/timestamp.h"
2221

2322
/*
2423
* On Windows, <wincrypt.h> includes a #define for X509_NAME, which breaks our
@@ -35,7 +34,6 @@ PG_MODULE_MAGIC;
3534

3635
staticDatumX509_NAME_field_to_text(X509_NAME*name,text*fieldName);
3736
staticDatumASN1_STRING_to_text(ASN1_STRING*str);
38-
staticDatumASN1_TIME_to_timestamp(ASN1_TIME*time);
3937

4038
/*
4139
* Function context for data persisting over repeated calls.
@@ -227,39 +225,6 @@ X509_NAME_field_to_text(X509_NAME *name, text *fieldName)
227225
}
228226

229227

230-
/*
231-
* Converts OpenSSL ASN1_TIME structure into timestamp
232-
*
233-
* Parameter: time - OpenSSL ASN1_TIME structure.
234-
*
235-
* Returns Datum, which can be directly returned from a C language SQL
236-
* function.
237-
*/
238-
staticDatum
239-
ASN1_TIME_to_timestamp(ASN1_TIME*time)
240-
{
241-
structtmtm_time;
242-
structpg_tmpgtm_time;
243-
Timestampts;
244-
245-
ASN1_TIME_to_tm(time,&tm_time);
246-
247-
pgtm_time.tm_sec=tm_time.tm_sec;
248-
pgtm_time.tm_min=tm_time.tm_min;
249-
pgtm_time.tm_hour=tm_time.tm_hour;
250-
pgtm_time.tm_mday=tm_time.tm_mday;
251-
pgtm_time.tm_mon=tm_time.tm_mon+1;
252-
pgtm_time.tm_year=tm_time.tm_year+1900;
253-
254-
if (tm2timestamp(&pgtm_time,0,NULL,&ts))
255-
ereport(ERROR,
256-
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
257-
errmsg("failed to convert tm to timestamp")));
258-
259-
PG_RETURN_TIMESTAMP(ts);
260-
}
261-
262-
263228
/*
264229
* Returns specified field of client certificate distinguished name
265230
*
@@ -517,35 +482,3 @@ ssl_extension_info(PG_FUNCTION_ARGS)
517482
/* All done */
518483
SRF_RETURN_DONE(funcctx);
519484
}
520-
521-
/*
522-
* Returns current client certificate notBefore timestamp in
523-
* timestamp data type
524-
*/
525-
PG_FUNCTION_INFO_V1(ssl_client_get_notbefore);
526-
Datum
527-
ssl_client_get_notbefore(PG_FUNCTION_ARGS)
528-
{
529-
X509*cert=MyProcPort->peer;
530-
531-
if (!MyProcPort->ssl_in_use|| !MyProcPort->peer_cert_valid)
532-
PG_RETURN_NULL();
533-
534-
returnASN1_TIME_to_timestamp(X509_get_notBefore(cert));
535-
}
536-
537-
/*
538-
* Returns current client certificate notAfter timestamp in
539-
* timestamp data type
540-
*/
541-
PG_FUNCTION_INFO_V1(ssl_client_get_notafter);
542-
Datum
543-
ssl_client_get_notafter(PG_FUNCTION_ARGS)
544-
{
545-
X509*cert=MyProcPort->peer;
546-
547-
if (!MyProcPort->ssl_in_use|| !MyProcPort->peer_cert_valid)
548-
PG_RETURN_NULL();
549-
550-
returnASN1_TIME_to_timestamp(X509_get_notAfter(cert));
551-
}

‎contrib/sslinfo/sslinfo.control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# sslinfo extension
22
comment = 'information about SSL certificates'
3-
default_version = '1.3'
3+
default_version = '1.2'
44
module_pathname = '$libdir/sslinfo'
55
relocatable = true

‎doc/src/sgml/monitoring.sgml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,26 +2257,6 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
22572257
This field is truncated like <structfield>client_dn</structfield>.
22582258
</para></entry>
22592259
</row>
2260-
2261-
<row>
2262-
<entry role="catalog_table_entry"><para role="column_definition">
2263-
<structfield>not_before</structfield> <type>text</type>
2264-
</para>
2265-
<para>
2266-
Not before UTC timestamp of the client certificate, or NULL if no client
2267-
certificate was supplied.
2268-
</para></entry>
2269-
</row>
2270-
2271-
<row>
2272-
<entry role="catalog_table_entry"><para role="column_definition">
2273-
<structfield>not_after</structfield> <type>text</type>
2274-
</para>
2275-
<para>
2276-
Not after UTC timestamp of the client certificate, or NULL if no client
2277-
certificate was supplied.
2278-
</para></entry>
2279-
</row>
22802260
</tbody>
22812261
</tgroup>
22822262
</table>

‎doc/src/sgml/sslinfo.sgml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -240,36 +240,6 @@ emailAddress
240240
</para>
241241
</listitem>
242242
</varlistentry>
243-
244-
<varlistentry>
245-
<term>
246-
<function>ssl_client_get_notbefore() returns text</function>
247-
<indexterm>
248-
<primary>ssl_client_get_notbefore</primary>
249-
</indexterm>
250-
</term>
251-
<listitem>
252-
<para>
253-
Return the <structfield>not before</structfield> UTC timestamp of the client
254-
certificate.
255-
</para>
256-
</listitem>
257-
</varlistentry>
258-
259-
<varlistentry>
260-
<term>
261-
<function>ssl_client_get_notafter() returns text</function>
262-
<indexterm>
263-
<primary>ssl_client_get_notafter</primary>
264-
</indexterm>
265-
</term>
266-
<listitem>
267-
<para>
268-
Return the <structfield>not after</structfield> UTC timestamp of the client
269-
certificate.
270-
</para>
271-
</listitem>
272-
</varlistentry>
273243
</variablelist>
274244
</sect2>
275245

‎src/backend/catalog/system_views.sql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -970,9 +970,7 @@ CREATE VIEW pg_stat_ssl AS
970970
S.sslbitsAS bits,
971971
S.ssl_client_dnAS client_dn,
972972
S.ssl_client_serialAS client_serial,
973-
S.ssl_issuer_dnAS issuer_dn,
974-
S.ssl_not_beforeAS not_before,
975-
S.ssl_not_afterAS not_after
973+
S.ssl_issuer_dnAS issuer_dn
976974
FROM pg_stat_get_activity(NULL)AS S
977975
WHERES.client_portIS NOT NULL;
978976

‎src/backend/libpq/be-secure-openssl.c

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include"tcop/tcopprot.h"
3737
#include"utils/builtins.h"
3838
#include"utils/memutils.h"
39-
#include"utils/timestamp.h"
4039

4140
/*
4241
* These SSL-related #includes must come after all system-provided headers.
@@ -73,7 +72,6 @@ static bool initialize_ecdh(SSL_CTX *context, bool isServerStart);
7372
staticconstchar*SSLerrmessage(unsigned longecode);
7473

7574
staticchar*X509_NAME_to_cstring(X509_NAME*name);
76-
staticTimestampASN1_TIME_to_timestamp(ASN1_TIME*time);
7775

7876
staticSSL_CTX*SSL_context=NULL;
7977
staticboolSSL_initialized= false;
@@ -1408,24 +1406,6 @@ be_tls_get_peer_issuer_name(Port *port, char *ptr, size_t len)
14081406
ptr[0]='\0';
14091407
}
14101408

1411-
void
1412-
be_tls_get_peer_not_before(Port*port,Timestamp*ptr)
1413-
{
1414-
if (port->peer)
1415-
*ptr=ASN1_TIME_to_timestamp(X509_get_notBefore(port->peer));
1416-
else
1417-
*ptr=0;
1418-
}
1419-
1420-
void
1421-
be_tls_get_peer_not_after(Port*port,Timestamp*ptr)
1422-
{
1423-
if (port->peer)
1424-
*ptr=ASN1_TIME_to_timestamp(X509_get_notAfter(port->peer));
1425-
else
1426-
*ptr=0;
1427-
}
1428-
14291409
void
14301410
be_tls_get_peer_serial(Port*port,char*ptr,size_tlen)
14311411
{
@@ -1569,33 +1549,6 @@ X509_NAME_to_cstring(X509_NAME *name)
15691549
returnresult;
15701550
}
15711551

1572-
/*
1573-
* Convert an ASN1_TIME to a Timestamp
1574-
*/
1575-
staticTimestamp
1576-
ASN1_TIME_to_timestamp(ASN1_TIME*time)
1577-
{
1578-
structtmtm_time;
1579-
structpg_tmpgtm_time;
1580-
Timestampts;
1581-
1582-
ASN1_TIME_to_tm(time,&tm_time);
1583-
1584-
pgtm_time.tm_sec=tm_time.tm_sec;
1585-
pgtm_time.tm_min=tm_time.tm_min;
1586-
pgtm_time.tm_hour=tm_time.tm_hour;
1587-
pgtm_time.tm_mday=tm_time.tm_mday;
1588-
pgtm_time.tm_mon=tm_time.tm_mon+1;
1589-
pgtm_time.tm_year=tm_time.tm_year+1900;
1590-
1591-
if (tm2timestamp(&pgtm_time,0,NULL,&ts))
1592-
ereport(ERROR,
1593-
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1594-
errmsg("timestamp out of range")));
1595-
1596-
returnts;
1597-
}
1598-
15991552
/*
16001553
* Convert TLS protocol version GUC enum to OpenSSL values
16011554
*

‎src/backend/utils/activity/backend_status.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,6 @@ pgstat_bestart(void)
367367
be_tls_get_peer_subject_name(MyProcPort,lsslstatus.ssl_client_dn,NAMEDATALEN);
368368
be_tls_get_peer_serial(MyProcPort,lsslstatus.ssl_client_serial,NAMEDATALEN);
369369
be_tls_get_peer_issuer_name(MyProcPort,lsslstatus.ssl_issuer_dn,NAMEDATALEN);
370-
be_tls_get_peer_not_before(MyProcPort,&lsslstatus.ssl_not_before);
371-
be_tls_get_peer_not_after(MyProcPort,&lsslstatus.ssl_not_after);
372370
}
373371
else
374372
{

‎src/backend/utils/adt/pgstatfuncs.c

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ pg_stat_get_progress_info(PG_FUNCTION_ARGS)
303303
Datum
304304
pg_stat_get_activity(PG_FUNCTION_ARGS)
305305
{
306-
#definePG_STAT_GET_ACTIVITY_COLS33
306+
#definePG_STAT_GET_ACTIVITY_COLS31
307307
intnum_backends=pgstat_fetch_stat_numbackends();
308308
intcurr_backend;
309309
intpid=PG_ARGISNULL(0) ?-1 :PG_GETARG_INT32(0);
@@ -395,7 +395,7 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
395395
pfree(clipped_activity);
396396

397397
/* leader_pid */
398-
nulls[31]= true;
398+
nulls[29]= true;
399399

400400
proc=BackendPidGetProc(beentry->st_procpid);
401401

@@ -432,17 +432,17 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
432432
*/
433433
if (leader&&leader->pid!=beentry->st_procpid)
434434
{
435-
values[31]=Int32GetDatum(leader->pid);
436-
nulls[31]= false;
435+
values[29]=Int32GetDatum(leader->pid);
436+
nulls[29]= false;
437437
}
438438
elseif (beentry->st_backendType==B_BG_WORKER)
439439
{
440440
intleader_pid=GetLeaderApplyWorkerPid(beentry->st_procpid);
441441

442442
if (leader_pid!=InvalidPid)
443443
{
444-
values[31]=Int32GetDatum(leader_pid);
445-
nulls[31]= false;
444+
values[29]=Int32GetDatum(leader_pid);
445+
nulls[29]= false;
446446
}
447447
}
448448
}
@@ -587,45 +587,35 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
587587
values[24]=CStringGetTextDatum(beentry->st_sslstatus->ssl_issuer_dn);
588588
else
589589
nulls[24]= true;
590-
591-
if (beentry->st_sslstatus->ssl_not_before!=0)
592-
values[25]=TimestampGetDatum(beentry->st_sslstatus->ssl_not_before);
593-
else
594-
nulls[25]= true;
595-
596-
if (beentry->st_sslstatus->ssl_not_after!=0)
597-
values[26]=TimestampGetDatum(beentry->st_sslstatus->ssl_not_after);
598-
else
599-
nulls[26]= true;
600590
}
601591
else
602592
{
603593
values[18]=BoolGetDatum(false);/* ssl */
604-
nulls[19]=nulls[20]=nulls[21]=nulls[22]=nulls[23]=nulls[24]=nulls[25]=nulls[26]=true;
594+
nulls[19]=nulls[20]=nulls[21]=nulls[22]=nulls[23]=nulls[24]= true;
605595
}
606596

607597
/* GSSAPI information */
608598
if (beentry->st_gss)
609599
{
610-
values[27]=BoolGetDatum(beentry->st_gssstatus->gss_auth);/* gss_auth */
611-
values[28]=CStringGetTextDatum(beentry->st_gssstatus->gss_princ);
612-
values[29]=BoolGetDatum(beentry->st_gssstatus->gss_enc);/* GSS Encryption in use */
613-
values[30]=BoolGetDatum(beentry->st_gssstatus->gss_delegation);/* GSS credentials
600+
values[25]=BoolGetDatum(beentry->st_gssstatus->gss_auth);/* gss_auth */
601+
values[26]=CStringGetTextDatum(beentry->st_gssstatus->gss_princ);
602+
values[27]=BoolGetDatum(beentry->st_gssstatus->gss_enc);/* GSS Encryption in use */
603+
values[28]=BoolGetDatum(beentry->st_gssstatus->gss_delegation);/* GSS credentials
614604
* delegated */
615605
}
616606
else
617607
{
618-
values[27]=BoolGetDatum(false);/* gss_auth */
619-
nulls[28]= true;/* No GSS principal */
620-
values[29]=BoolGetDatum(false);/* GSS Encryption not in
608+
values[25]=BoolGetDatum(false);/* gss_auth */
609+
nulls[26]= true;/* No GSS principal */
610+
values[27]=BoolGetDatum(false);/* GSS Encryption not in
621611
* use */
622-
values[30]=BoolGetDatum(false);/* GSS credentials not
612+
values[28]=BoolGetDatum(false);/* GSS credentials not
623613
* delegated */
624614
}
625615
if (beentry->st_query_id==0)
626-
nulls[32]= true;
616+
nulls[30]= true;
627617
else
628-
values[32]=UInt64GetDatum(beentry->st_query_id);
618+
values[30]=UInt64GetDatum(beentry->st_query_id);
629619
}
630620
else
631621
{
@@ -655,8 +645,6 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
655645
nulls[28]= true;
656646
nulls[29]= true;
657647
nulls[30]= true;
658-
nulls[31]= true;
659-
nulls[32]= true;
660648
}
661649

662650
tuplestore_putvalues(rsinfo->setResult,rsinfo->setDesc,values,nulls);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp