]> git.meshlink.io Git - catta/commitdiff
* add support for setting enable-dbus to "warn" in avahi-daemon.conf
authorLennart Poettering <lennart@poettering.net>
Mon, 22 Aug 2005 20:26:18 +0000 (20:26 +0000)
committerLennart Poettering <lennart@poettering.net>
Mon, 22 Aug 2005 20:26:18 +0000 (20:26 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@397 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-daemon/main.c
man/avahi-daemon.conf.5.xml.in

index 76b03d0a599038947d0e2a87a2bd1a8c1bf3ce86..4c3a06960ba41d4a3f3adfa1fe095b9ce0e4379d 100644 (file)
@@ -78,7 +78,10 @@ typedef struct {
     int daemonize;
     int use_syslog;
     char *config_file;
+#ifdef HAVE_DBUS
     int enable_dbus;
+    int fail_on_missing_dbus;
+#endif
     int drop_root;
     int publish_resolv_conf;
     char ** publish_dns_servers;
@@ -380,8 +383,20 @@ static int load_config_file(DaemonConfig *c) {
                     c->server_config.check_response_ttl = is_yes(p->value);
                 else if (strcasecmp(p->key, "use-iff-running") == 0)
                     c->server_config.use_iff_running = is_yes(p->value);
-                else if (strcasecmp(p->key, "enable-dbus") == 0)
-                    c->enable_dbus = is_yes(p->value);
+#ifdef HAVE_DBUS                
+                else if (strcasecmp(p->key, "enable-dbus") == 0) {
+
+                    if (*(p->value) == 'w' || *(p->value) == 'W') {
+                        c->fail_on_missing_dbus = 0;
+                        c->enable_dbus = 1;
+                    } else if (*(p->value) == 'y' || *(p->value) == 'Y') {
+                        c->fail_on_missing_dbus = 1;
+                        c->enable_dbus = 1;
+                    } else
+                        c->enable_dbus = 0;
+                    
+                }
+#endif
                 else if (strcasecmp(p->key, "drop-root") == 0)
                     c->drop_root = is_yes(p->value);
                 else {
@@ -587,8 +602,14 @@ static int run_server(DaemonConfig *c) {
     
 #ifdef HAVE_DBUS
     if (c->enable_dbus)
-        if (dbus_protocol_setup(poll_api) < 0)
-            goto finish;
+        if (dbus_protocol_setup(poll_api) < 0) {
+
+            if (c->fail_on_missing_dbus)
+                goto finish;
+
+            avahi_log_warn("WARNING: Failed to contact D-BUS daemon, disabling D-BUS support.");
+            c->enable_dbus = 0;
+        }
 #endif
     
     load_resolv_conf(c);
@@ -825,7 +846,10 @@ int main(int argc, char *argv[]) {
     config.command = DAEMON_RUN;
     config.daemonize = 0;
     config.config_file = NULL;
+#ifdef HAVE_DBUS
     config.enable_dbus = 1;
+    config.fail_on_missing_dbus = 1;
+#endif
     config.drop_root = 1;
     config.publish_dns_servers = NULL;
     config.publish_resolv_conf = 0;
index cac071711f5f210f775686271cd2f4de0ec87cfb..9d13ce5af2e9bd9c637c9222b3a1f624cb54387c 100644 (file)
       </option>
 
       <option>
-        <p><opt>enable-dbus=</opt> Takes a boolean value ("yes" or
-        "no"). If set to "yes" avahi-daemon connects to DBUS, to offer
-        an object oriented client API. Only available if avahi has
-        been compiled with <opt>--enable-dbus</opt> in which case it
-        defaults to "yes".</p>
+        <p><opt>enable-dbus=</opt> Takes either "yes", "no" or
+        "warn". If set to "yes" avahi-daemon connects to D-BUS,
+        offering an object oriented client API. It is only available
+        if avahi has been compiled with <opt>--enable-dbus</opt> in
+        which case it defaults to "yes". "warn" behaves like "yes",
+        but the daemon starts up even when it fails to connect to a
+        D-BUS daemon.</p>
       </option>
 
        </section>