Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4754dbf

Browse files
committed
Make GUC variables for syslog and SSL always visible
Make the variables visible (but not used) even when support is not compiled in.
1 parent 3026027 commit 4754dbf

File tree

2 files changed

+27
-21
lines changed

2 files changed

+27
-21
lines changed

src/backend/libpq/be-secure.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ int ssl_renegotiation_limit;
103103
#ifdef USE_SSL
104104
static SSL_CTX *SSL_context = NULL;
105105
static bool ssl_loaded_verify_locations = false;
106+
#endif
106107

107108
/* GUC variable controlling SSL cipher list */
108109
char *SSLCipherSuites = NULL;
109-
#endif
110110

111111
/* ------------------------------------------------------------ */
112112
/* Hardcoded values */

src/backend/utils/misc/guc.c

+26-20
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ extern char *temp_tablespaces;
128128
extern bool synchronize_seqscans;
129129
extern bool fullPageWrites;
130130
extern int ssl_renegotiation_limit;
131+
extern char *SSLCipherSuites;
131132

132133
#ifdef TRACE_SORT
133134
extern bool trace_sort;
@@ -139,10 +140,6 @@ extern bool trace_syncscan;
139140
extern bool optimize_bounded_sort;
140141
#endif
141142

142-
#ifdef USE_SSL
143-
extern char *SSLCipherSuites;
144-
#endif
145-
146143
static void set_config_sourcefile(const char *name, char *sourcefile,
147144
int sourceline);
148145

@@ -151,12 +148,14 @@ static const char *assign_log_destination(const char *value,
151148

152149
#ifdef HAVE_SYSLOG
153150
static int syslog_facility = LOG_LOCAL0;
151+
#else
152+
static int syslog_facility = 0;
153+
#endif
154154

155155
static bool assign_syslog_facility(int newval,
156156
bool doit, GucSource source);
157157
static const char *assign_syslog_ident(const char *ident,
158158
bool doit, GucSource source);
159-
#endif
160159

161160
static bool assign_session_replication_role(int newval, bool doit,
162161
GucSource source);
@@ -280,8 +279,8 @@ static const struct config_enum_entry session_replication_role_options[] = {
280279
{NULL, 0, false}
281280
};
282281

283-
#ifdef HAVE_SYSLOG
284282
static const struct config_enum_entry syslog_facility_options[] = {
283+
#ifdef HAVE_SYSLOG
285284
{"local0", LOG_LOCAL0, false},
286285
{"local1", LOG_LOCAL1, false},
287286
{"local2", LOG_LOCAL2, false},
@@ -290,9 +289,11 @@ static const struct config_enum_entry syslog_facility_options[] = {
290289
{"local5", LOG_LOCAL5, false},
291290
{"local6", LOG_LOCAL6, false},
292291
{"local7", LOG_LOCAL7, false},
292+
#else
293+
{"none", 0, false},
294+
#endif
293295
{NULL, 0}
294296
};
295-
#endif
296297

297298
static const struct config_enum_entry track_function_options[] = {
298299
{"none", TRACK_FUNC_OFF, false},
@@ -410,9 +411,7 @@ int tcp_keepalives_count;
410411
*/
411412
static char *log_destination_string;
412413

413-
#ifdef HAVE_SYSLOG
414414
static char *syslog_ident_str;
415-
#endif
416415
static bool phony_autocommit;
417416
static bool session_auth_is_superuser;
418417
static double phony_random_seed;
@@ -2531,7 +2530,6 @@ static struct config_string ConfigureNamesString[] =
25312530
"postgresql-%Y-%m-%d_%H%M%S.log", NULL, NULL
25322531
},
25332532

2534-
#ifdef HAVE_SYSLOG
25352533
{
25362534
{"syslog_ident", PGC_SIGHUP, LOGGING_WHERE,
25372535
gettext_noop("Sets the program name used to identify PostgreSQL "
@@ -2541,7 +2539,6 @@ static struct config_string ConfigureNamesString[] =
25412539
&syslog_ident_str,
25422540
"postgres", assign_syslog_ident, NULL
25432541
},
2544-
#endif
25452542

25462543
{
25472544
{"TimeZone", PGC_USERSET, CLIENT_CONN_LOCALE,
@@ -2680,17 +2677,20 @@ static struct config_string ConfigureNamesString[] =
26802677
"pg_catalog.simple", assignTSCurrentConfig, NULL
26812678
},
26822679

2683-
#ifdef USE_SSL
26842680
{
26852681
{"ssl_ciphers", PGC_POSTMASTER, CONN_AUTH_SECURITY,
26862682
gettext_noop("Sets the list of allowed SSL ciphers."),
26872683
NULL,
26882684
GUC_SUPERUSER_ONLY
26892685
},
26902686
&SSLCipherSuites,
2691-
"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH", NULL, NULL
2687+
#ifdef USE_SSL
2688+
"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH",
2689+
#else
2690+
"none",
2691+
#endif
2692+
NULL, NULL
26922693
},
2693-
#endif /* USE_SSL */
26942694

26952695
{
26962696
{"application_name", PGC_USERSET, LOGGING_WHAT,
@@ -2807,16 +2807,19 @@ static struct config_enum ConfigureNamesEnum[] =
28072807
LOGSTMT_NONE, log_statement_options, NULL, NULL
28082808
},
28092809

2810-
#ifdef HAVE_SYSLOG
28112810
{
28122811
{"syslog_facility", PGC_SIGHUP, LOGGING_WHERE,
28132812
gettext_noop("Sets the syslog \"facility\" to be used when syslog enabled."),
28142813
NULL
28152814
},
28162815
&syslog_facility,
2817-
LOG_LOCAL0, syslog_facility_options, assign_syslog_facility, NULL
2818-
},
2816+
#ifdef HAVE_SYSLOG
2817+
LOG_LOCAL0,
2818+
#else
2819+
0,
28192820
#endif
2821+
syslog_facility_options, assign_syslog_facility, NULL
2822+
},
28202823

28212824
{
28222825
{"session_replication_role", PGC_SUSET, CLIENT_CONN_STATEMENT,
@@ -7637,27 +7640,30 @@ assign_log_destination(const char *value, bool doit, GucSource source)
76377640
return value;
76387641
}
76397642

7640-
#ifdef HAVE_SYSLOG
7641-
76427643
static bool
76437644
assign_syslog_facility(int newval, bool doit, GucSource source)
76447645
{
7646+
#ifdef HAVE_SYSLOG
76457647
if (doit)
76467648
set_syslog_parameters(syslog_ident_str ? syslog_ident_str : "postgres",
76477649
newval);
7650+
#endif
7651+
/* Without syslog support, just ignore it */
76487652

76497653
return true;
76507654
}
76517655

76527656
static const char *
76537657
assign_syslog_ident(const char *ident, bool doit, GucSource source)
76547658
{
7659+
#ifdef HAVE_SYSLOG
76557660
if (doit)
76567661
set_syslog_parameters(ident, syslog_facility);
7662+
#endif
7663+
/* Without syslog support, it will always be set to "none", so ignore */
76577664

76587665
return ident;
76597666
}
7660-
#endif /* HAVE_SYSLOG */
76617667

76627668

76637669
static bool

0 commit comments

Comments
 (0)