]> git.saurik.com Git - apple/configd.git/blobdiff - dnsinfo/dnsinfo_private.c
configd-395.11.tar.gz
[apple/configd.git] / dnsinfo / dnsinfo_private.c
index 6ada24f8963be2b40c3fc3e095e9629dd6bca571..f7b256f4c8d7e518299d4277bf91d1f1a7cb3bee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004, 2005, 2007, 2009 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
  * - initial revision
  */
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 #include <servers/bootstrap.h>
+#include <bootstrap_priv.h>
 
 #include "dnsinfo_private.h"
 #include "shared_dns_info_types.h"
@@ -41,7 +43,7 @@ __private_extern__
 const char *
 _dns_configuration_notify_key()
 {
-       return "com.apple.SystemConfiguration.dns_configuration";
+       return "com.apple.system.SystemConfiguration.dns_configuration";
 }
 
 
@@ -58,16 +60,30 @@ _dns_configuration_server_port()
                server_name = DNS_SERVER;
        }
 
+#ifdef BOOTSTRAP_PRIVILEGED_SERVER
+       status = bootstrap_look_up2(bootstrap_port,
+                                   server_name,
+                                   &server,
+                                   0,
+                                   BOOTSTRAP_PRIVILEGED_SERVER);
+#else  // BOOTSTRAP_PRIVILEGED_SERVER
        status = bootstrap_look_up(bootstrap_port, server_name, &server);
+#endif // BOOTSTRAP_PRIVILEGED_SERVER
+
        switch (status) {
                case BOOTSTRAP_SUCCESS :
                        /* service currently registered, "a good thing" (tm) */
                        break;
+               case BOOTSTRAP_NOT_PRIVILEGED :
+                       /* the service is not privileged */
+                       return MACH_PORT_NULL;
                case BOOTSTRAP_UNKNOWN_SERVICE :
                        /* service not currently registered, try again later */
                        return MACH_PORT_NULL;
                default :
-                       mach_error("could not lookup DNS configuration info service:", status);
+                       fprintf(stderr,
+                               "could not lookup DNS configuration info service: %s\n",
+                               bootstrap_strerror(status));
                        return MACH_PORT_NULL;
        }