aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-09-08 17:08:36 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-09-08 17:08:36 +0000
commiteeb6cb143a005641841e718cb8638bc0c684ec25 (patch)
treef9484aae6787ac93e18d19b547d041ae01a4ed76 /src/backend
parent59b9f3d36d56fa2bc998c4169f650b0a501874ea (diff)
downloadpostgresql-eeb6cb143a005641841e718cb8638bc0c684ec25.tar.gz
postgresql-eeb6cb143a005641841e718cb8638bc0c684ec25.zip
Add a boolean GUC parameter "bonjour" to control whether a Bonjour-enabled
build actually attempts to advertise itself via Bonjour. Formerly it always did so, which meant that packagers had to decide for their users whether this behavior was wanted or not. The default is "off" to be on the safe side, though this represents a change in the default behavior of a Bonjour-enabled build. Per discussion.
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/postmaster/postmaster.c5
-rw-r--r--src/backend/utils/misc/guc.c28
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample2
3 files changed, 31 insertions, 4 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 424bb72236d..b616eaca135 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.595 2009/09/08 16:08:26 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.596 2009/09/08 17:08:36 tgl Exp $
*
* NOTES
*
@@ -200,6 +200,7 @@ bool log_hostname; /* for ps display and logging */
bool Log_connections = false;
bool Db_user_namespace = false;
+bool enable_bonjour = false;
char *bonjour_name;
/* PIDs of special child processes; 0 when not running */
@@ -854,7 +855,7 @@ PostmasterMain(int argc, char *argv[])
#ifdef USE_BONJOUR
/* Register for Bonjour only if we opened TCP socket(s) */
- if (ListenSocket[0] != -1)
+ if (enable_bonjour && ListenSocket[0] != -1)
{
DNSServiceErrorType err;
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 70dcefbc315..608378cb4b7 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.515 2009/09/03 22:08:05 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.516 2009/09/08 17:08:36 tgl Exp $
*
*--------------------------------------------------------------------
*/
@@ -152,6 +152,7 @@ static bool assign_phony_autocommit(bool newval, bool doit, GucSource source);
static const char *assign_custom_variable_classes(const char *newval, bool doit,
GucSource source);
static bool assign_debug_assertions(bool newval, bool doit, GucSource source);
+static bool assign_bonjour(bool newval, bool doit, GucSource source);
static bool assign_ssl(bool newval, bool doit, GucSource source);
static bool assign_stage_log_stats(bool newval, bool doit, GucSource source);
static bool assign_log_stats(bool newval, bool doit, GucSource source);
@@ -682,6 +683,14 @@ static struct config_bool ConfigureNamesBool[] =
false, NULL, NULL
},
{
+ {"bonjour", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
+ gettext_noop("Enables advertising the server via Bonjour."),
+ NULL
+ },
+ &enable_bonjour,
+ false, assign_bonjour, NULL
+ },
+ {
{"ssl", PGC_POSTMASTER, CONN_AUTH_SECURITY,
gettext_noop("Enables SSL connections."),
NULL
@@ -2199,7 +2208,7 @@ static struct config_string ConfigureNamesString[] =
{
{"bonjour_name", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
- gettext_noop("Sets the Bonjour broadcast service name."),
+ gettext_noop("Sets the Bonjour service name."),
NULL
},
&bonjour_name,
@@ -7395,6 +7404,21 @@ assign_debug_assertions(bool newval, bool doit, GucSource source)
}
static bool
+assign_bonjour(bool newval, bool doit, GucSource source)
+{
+#ifndef USE_BONJOUR
+ if (newval)
+ {
+ ereport(GUC_complaint_elevel(source),
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("Bonjour is not supported by this build")));
+ return false;
+ }
+#endif
+ return true;
+}
+
+static bool
assign_ssl(bool newval, bool doit, GucSource source)
{
#ifndef USE_SSL
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index c6c02fcd812..4a361391f2c 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -69,6 +69,8 @@
#unix_socket_group = '' # (change requires restart)
#unix_socket_permissions = 0777 # begin with 0 to use octal notation
# (change requires restart)
+#bonjour = off # advertise server via Bonjour
+ # (change requires restart)
#bonjour_name = '' # defaults to the computer name
# (change requires restart)