]> git.saurik.com Git - apple/libinfo.git/commitdiff
Libinfo-517.tar.gz macos-1013 macos-10131 v517
authorApple <opensource@apple.com>
Thu, 22 Jun 2017 00:19:45 +0000 (00:19 +0000)
committerApple <opensource@apple.com>
Thu, 22 Jun 2017 00:19:45 +0000 (00:19 +0000)
15 files changed:
Libinfo.xcodeproj/project.pbxproj
dns.subproj/res_query.c
gen.subproj/configuration_profile.c
gen.subproj/gethostbyname.3
gen.subproj/if_nameindex.c
lookup.subproj/ds_module.c
lookup.subproj/file_module.c
lookup.subproj/getpwent.3
lookup.subproj/libinfo.c [changed mode: 0644->0755]
lookup.subproj/mdns_module.c
lookup.subproj/netdb.h
lookup.subproj/si_data.c
membership.subproj/membership.c
rpc.subproj/svc_tcp.c
xcodescripts/Libinfo.xcconfig

index c3189894ea2155f75be9347642c73669123c62eb..3aeb56a17abbcba35e133532cc0ef43dff55ab0a 100644 (file)
@@ -25,7 +25,7 @@
                2D31A0FC128074E700D5A84C /* getifmaddrs.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D31A0FB128074E700D5A84C /* getifmaddrs.c */; };
                2D4070B1129354A700FE81ED /* getnameinfo_link.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D4070B0129354A700FE81ED /* getnameinfo_link.c */; };
                2D5DD5D21608E6E80051891A /* configuration_profile.c in Sources */ = {isa = PBXBuildFile; fileRef = 2D5DD5D01608E6E80051891A /* configuration_profile.c */; };
-               C965793A1B94C97100624699 /* muser_module.c in Sources */ = {isa = PBXBuildFile; fileRef = C96579391B94C97100624699 /* muser_module.c */; settings = {ASSET_TAGS = (); }; };
+               C965793A1B94C97100624699 /* muser_module.c in Sources */ = {isa = PBXBuildFile; fileRef = C96579391B94C97100624699 /* muser_module.c */; };
                FC5284C011478C200058CCB0 /* herror.c in Sources */ = {isa = PBXBuildFile; fileRef = FC5283EE11478C200058CCB0 /* herror.c */; };
                FC5284C811478C200058CCB0 /* res_comp.c in Sources */ = {isa = PBXBuildFile; fileRef = FC5283F711478C200058CCB0 /* res_comp.c */; };
                FC5284CD11478C200058CCB0 /* res_query.c in Sources */ = {isa = PBXBuildFile; fileRef = FC5283FC11478C200058CCB0 /* res_query.c */; };
@@ -51,7 +51,6 @@
                FC5284F411478C200058CCB0 /* thread_data.c in Sources */ = {isa = PBXBuildFile; fileRef = FC52843811478C200058CCB0 /* thread_data.c */; };
                FC5284F711478C200058CCB0 /* membership.c in Sources */ = {isa = PBXBuildFile; fileRef = FC52843E11478C200058CCB0 /* membership.c */; };
                FC5284FD11478C200058CCB0 /* getdomainname.c in Sources */ = {isa = PBXBuildFile; fileRef = FC52844611478C200058CCB0 /* getdomainname.c */; };
-               FC5284FE11478C200058CCB0 /* getnetgrent.c in Sources */ = {isa = PBXBuildFile; fileRef = FC52844711478C200058CCB0 /* getnetgrent.c */; };
                FC5284FF11478C200058CCB0 /* innetgr.c in Sources */ = {isa = PBXBuildFile; fileRef = FC52844811478C200058CCB0 /* innetgr.c */; };
                FC52850111478C200058CCB0 /* setdomainname.c in Sources */ = {isa = PBXBuildFile; fileRef = FC52844A11478C200058CCB0 /* setdomainname.c */; };
                FC52850211478C200058CCB0 /* xdr_domainname.c in Sources */ = {isa = PBXBuildFile; fileRef = FC52844B11478C200058CCB0 /* xdr_domainname.c */; };
                FC52841911478C200058CCB0 /* bootparams.5 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = bootparams.5; sourceTree = "<group>"; };
                FC52841A11478C200058CCB0 /* bootparams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bootparams.h; sourceTree = "<group>"; };
                FC52841B11478C200058CCB0 /* cache_module.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cache_module.c; sourceTree = "<group>"; };
-               FC52841C11478C200058CCB0 /* ds_module.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ds_module.c; sourceTree = "<group>"; };
+               FC52841C11478C200058CCB0 /* ds_module.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ds_module.c; sourceTree = "<group>"; usesTabs = 1; };
                FC52841D11478C200058CCB0 /* file_module.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = file_module.c; sourceTree = "<group>"; };
                FC52841E11478C200058CCB0 /* gai_strerror.3 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gai_strerror.3; sourceTree = "<group>"; };
                FC52841F11478C200058CCB0 /* getaddrinfo.3 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = getaddrinfo.3; sourceTree = "<group>"; };
                FC52842811478C200058CCB0 /* initgroups.3 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = initgroups.3; sourceTree = "<group>"; };
                FC52842911478C200058CCB0 /* kvbuf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kvbuf.c; sourceTree = "<group>"; };
                FC52842A11478C200058CCB0 /* kvbuf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kvbuf.h; sourceTree = "<group>"; };
-               FC52842B11478C200058CCB0 /* libinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = libinfo.c; sourceTree = "<group>"; };
+               FC52842B11478C200058CCB0 /* libinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = libinfo.c; sourceTree = "<group>"; usesTabs = 1; };
                FC52842C11478C200058CCB0 /* libinfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libinfo.h; sourceTree = "<group>"; };
-               FC52842E11478C200058CCB0 /* mdns_module.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mdns_module.c; sourceTree = "<group>"; };
+               FC52842E11478C200058CCB0 /* mdns_module.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mdns_module.c; sourceTree = "<group>"; usesTabs = 1; };
                FC52842F11478C200058CCB0 /* netdb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = netdb.h; sourceTree = "<group>"; };
                FC52843011478C200058CCB0 /* netdb_async.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = netdb_async.h; sourceTree = "<group>"; };
                FC52843111478C200058CCB0 /* printerdb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = printerdb.h; sourceTree = "<group>"; };
                FC52843911478C200058CCB0 /* thread_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = thread_data.h; sourceTree = "<group>"; };
                FC52843C11478C200058CCB0 /* mbr_check_membership.3 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mbr_check_membership.3; sourceTree = "<group>"; };
                FC52843D11478C200058CCB0 /* mbr_uid_to_uuid.3 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mbr_uid_to_uuid.3; sourceTree = "<group>"; };
-               FC52843E11478C200058CCB0 /* membership.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = membership.c; sourceTree = "<group>"; };
+               FC52843E11478C200058CCB0 /* membership.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = membership.c; sourceTree = "<group>"; usesTabs = 1; };
                FC52843F11478C200058CCB0 /* membership.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = membership.h; sourceTree = "<group>"; };
                FC52844011478C200058CCB0 /* membershipPriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = membershipPriv.h; sourceTree = "<group>"; };
                FC52844111478C200058CCB0 /* ntsid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ntsid.h; sourceTree = "<group>"; };
                        );
                        path = lookup.subproj;
                        sourceTree = "<group>";
+                       usesTabs = 1;
                };
                FC52843A11478C200058CCB0 /* membership.subproj */ = {
                        isa = PBXGroup;
                        );
                        path = membership.subproj;
                        sourceTree = "<group>";
+                       usesTabs = 1;
                };
                FC52844511478C200058CCB0 /* nis.subproj */ = {
                        isa = PBXGroup;
                08FB7793FE84155DC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        attributes = {
-                               LastUpgradeCheck = 0700;
+                               LastUpgradeCheck = 0800;
                        };
                        buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "Libinfo" */;
                        compatibilityVersion = "Xcode 3.2";
                                FC5284F411478C200058CCB0 /* thread_data.c in Sources */,
                                FC5284F711478C200058CCB0 /* membership.c in Sources */,
                                FC5284FD11478C200058CCB0 /* getdomainname.c in Sources */,
-                               FC5284FE11478C200058CCB0 /* getnetgrent.c in Sources */,
                                FC5284FF11478C200058CCB0 /* innetgr.c in Sources */,
                                FC52850111478C200058CCB0 /* setdomainname.c in Sources */,
                                FC52850211478C200058CCB0 /* xdr_domainname.c in Sources */,
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 3F397F7D185BD67F00987BCC /* Libinfo.xcconfig */;
                        buildSettings = {
-                               COMBINE_HIDPI_IMAGES = YES;
                                PRODUCT_NAME = info;
-                               SUPPORTED_PLATFORMS = "macosx iphoneos";
-                               VERSION_INFO_EXPORT_DECL = static;
-                               VERSION_INFO_PREFIX = __;
                        };
                        name = Release;
                };
                1DEB915008733D8E0010E9CD /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
-                               BUILD_VARIANTS = (
-                                       normal,
-                                       profile,
-                                       debug,
-                               );
-                               CODE_SIGN_IDENTITY = "-";
-                               CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)";
-                               DEAD_CODE_STRIPPING = YES;
-                               DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                               DYLIB_CURRENT_VERSION = "$(CURRENT_PROJECT_VERSION)";
-                               GCC_C_LANGUAGE_STANDARD = gnu99;
-                               GCC_TREAT_WARNINGS_AS_ERRORS = YES;
-                               GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
-                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
-                               GCC_WARN_UNUSED_VARIABLE = YES;
-                               OTHER_CFLAGS = "";
-                               VERSIONING_SYSTEM = "apple-generic";
-                               WARNING_CFLAGS = "-Wno-error=deprecated-declarations";
-                               WARNING_LDFLAGS = "-Wall";
                        };
                        name = Release;
                };
                3F397F80185BD71500987BCC /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 3F397F7D185BD67F00987BCC /* Libinfo.xcconfig */;
                        buildSettings = {
                                PRODUCT_NAME = "$(TARGET_NAME)";
-                               SUPPORTED_PLATFORMS = iphonesimulator;
                        };
                        name = Release;
                };
                90E08A3C1BB364CA0093311B /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
-                               ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
-                               BUILD_VARIANTS = (
-                                       normal,
-                                       profile,
-                                       debug,
-                               );
-                               CODE_SIGN_IDENTITY = "-";
-                               CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)";
-                               DEAD_CODE_STRIPPING = YES;
-                               DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                               DYLIB_CURRENT_VERSION = "$(CURRENT_PROJECT_VERSION)";
-                               GCC_C_LANGUAGE_STANDARD = gnu99;
-                               GCC_OPTIMIZATION_LEVEL = 0;
-                               GCC_TREAT_WARNINGS_AS_ERRORS = YES;
-                               GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
-                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
-                               GCC_WARN_UNUSED_VARIABLE = YES;
-                               OTHER_CFLAGS = "-DDEBUG=1";
-                               VERSIONING_SYSTEM = "apple-generic";
-                               WARNING_CFLAGS = "-Wno-error=deprecated-declarations";
-                               WARNING_LDFLAGS = "-Wall";
                        };
                        name = Debug;
                };
                        isa = XCBuildConfiguration;
                        baseConfigurationReference = 3F397F7D185BD67F00987BCC /* Libinfo.xcconfig */;
                        buildSettings = {
-                               COMBINE_HIDPI_IMAGES = YES;
                                PRODUCT_NAME = info;
-                               SUPPORTED_PLATFORMS = "macosx iphoneos";
-                               VERSION_INFO_EXPORT_DECL = static;
-                               VERSION_INFO_PREFIX = __;
                        };
                        name = Debug;
                };
                90E08A3E1BB364CA0093311B /* Debug */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = 3F397F7D185BD67F00987BCC /* Libinfo.xcconfig */;
                        buildSettings = {
                                PRODUCT_NAME = "$(TARGET_NAME)";
-                               SUPPORTED_PLATFORMS = iphonesimulator;
                        };
                        name = Debug;
                };
index 3b048ef5cabece10b070b93a87b8f5a0458c349c..cfba37949d78867d002a0bcbf90bb2f57d085d3d 100644 (file)
@@ -61,6 +61,7 @@ _mdns_query(int call, const char *name, int class, int type, u_char *answer, int
        int res = -1;
        si_item_t *item;
        uint32_t err;
+       int cpylen = 0;
        
        si_mod_t *dns = si_module_with_name("mdns");
        if (dns == NULL) {
@@ -77,8 +78,14 @@ _mdns_query(int call, const char *name, int class, int type, u_char *answer, int
                
                res = p->dns_packet_len;
                
-               // Truncate to destination buffer size.
-               memcpy(answer, p->dns_packet, MIN(res, anslen));
+               if (res >= 0 && anslen >= 0) {
+                       // Truncate destination buffer size.
+                       memcpy(answer, p->dns_packet, (cpylen = MIN(res, anslen)));
+               }
+               else {
+                       h_errno = NO_RECOVERY;
+                       res = -1;
+               }
                
                si_item_release(item);
        } else {
@@ -86,7 +93,7 @@ _mdns_query(int call, const char *name, int class, int type, u_char *answer, int
                res = -1;
        }
 
-       if (MIN(res, anslen) >= sizeof(HEADER)) {
+       if (cpylen >= sizeof(HEADER)) {
                HEADER *hp = (HEADER *)answer;
                switch (hp->rcode) {
                        case NXDOMAIN:
index 1a0f0a2cf541e15afedb675b90fa4f725c5b97e4..7ee5363ea7bd89452a9ebaed7ea165b0b3535b20 100644 (file)
@@ -89,9 +89,13 @@ configuration_profile_copy_property_list(const char *ident)
        }
 
        data = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
-       if (data != NULL) out = xpc_create_from_plist(data, sb.st_size);
+       
+       if (data != MAP_FAILED)
+       {
+               out = xpc_create_from_plist(data, sb.st_size);
+               munmap(data, sb.st_size);
+       }
 
-       munmap(data, sb.st_size);
        close(fd);
 
        return out;
index 7c85286ff887fcc18de18bc632055dbd9e51ec6b..d791b3693d92dbe47d49f2b6190dce65e08047ce 100644 (file)
@@ -230,6 +230,17 @@ function returns a string which is the message text corresponding to the
 value of the
 .Fa err
 argument.
+.Pp
+Historically, passing a host's own hostname to
+.Fn gethostbyname
+or
+.Fn gethostbyname2
+has been a popular
+technique for determining that host's IP address(es), but this is fragile,
+and doesn't work reliably in all cases. The appropriate way for software to
+discover the IP address(es) of the host it is running on is to use
+.Xr getifaddrs 3 .
+.Pp
 .Sh FILES
 .Bl -tag -width /etc/nsswitch.conf -compact
 .It Pa /etc/hosts
index a9cf005648e6710514c31a1f1ff6dc4a23c0fd9f..06f1f5c17467fc0e5a2664b7b9cfce6b1148200a 100644 (file)
@@ -32,6 +32,8 @@
 #include <ifaddrs.h>
 #include <stdlib.h>
 #include <string.h>
+#include <os/overflow.h>
+#include <sys/errno.h>
 
 /*
  * From RFC 2553:
@@ -79,8 +81,9 @@ if_nameindex(void)
        struct ifaddrs *ifaddrs, *ifa;
        unsigned int ni;
        size_t nbytes;
-       struct if_nameindex *ifni, *ifni2;
+       struct if_nameindex *ifni= NULL, *ifni2;
        char *cp;
+       size_t cpsz;
 
        if (getifaddrs(&ifaddrs) < 0)
                return(NULL);
@@ -94,17 +97,38 @@ if_nameindex(void)
        for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
                if (ifa->ifa_addr &&
                    ifa->ifa_addr->sa_family == AF_LINK) {
-                       nbytes += strlen(ifa->ifa_name) + 1;
-                       ni++;
+                       /*
+                        * Security Check: Verify nbytes and ni do not overflow
+                        */
+                       if (os_add_overflow(nbytes, strlen(ifa->ifa_name) + 1, &nbytes) ||
+                               os_add_overflow(ni, 1, &ni)) {
+                               errno = EOVERFLOW;
+                               goto out;
+                       }
                }
        }
 
+       /*
+        * Security Check: Verify cpsz does not overflow in next 3 operations
+        */
+       if (os_add_overflow(ni, 1, &cpsz)) {
+               errno = EOVERFLOW;
+               goto out;
+       }
+       if (os_mul_overflow(cpsz, sizeof(struct if_nameindex), &cpsz)) {
+               errno = EOVERFLOW;
+               goto out;
+       }
+       if (os_add_overflow(cpsz, nbytes, &cpsz)) {
+               errno = EOVERFLOW;
+               goto out;
+       }
        /*
         * Next, allocate a chunk of memory, use the first part
         * for the array of structures, and the last part for
         * the strings.
         */
-       cp = malloc((ni + 1) * sizeof(struct if_nameindex) + nbytes);
+       cp = malloc(cpsz);
        ifni = (struct if_nameindex *)cp;
        if (ifni == NULL)
                goto out;
index e433ac4fe47b6c07d63d598a26c237d49fcf7909..ded2f9e49be5beac35faa3ce1d66fa782f48696e 100644 (file)
 #include <servers/bootstrap.h>
 #include <bootstrap_priv.h>
 #include <opendirectory/DSlibinfoMIG_types.h>
-#ifdef DEBUG
-#include <asl.h>
-#endif
+#include <os/activity.h>
+#include <os/log.h>
 
 #define IPV6_ADDR_LEN 16
 #define IPV4_ADDR_LEN 4
 
+/* The LI_OS_ACTIVITY macro contains os_activity_t functions
+ * that are not POSIX compliant. So calling them may
+ * inadvertantly change errno. To avoid this, the macro
+ * explicityly restores the errno to its state on entry
+ * when done.
+ *
+ * Macro cannot contain any {} because it will end the scope
+ * of the activity prematurely
+ */
+#define _LI_OS_ACTIVITY(_var, _desc) \
+       int _var = errno; \
+       os_activity_t activity __attribute__((__cleanup__(_li_auto_os_release))) = os_activity_create(_desc, OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); \
+       os_activity_scope(activity); \
+       errno = _var
+
+#define LI_OS_ACTIVITY(_desc) _LI_OS_ACTIVITY(OS_CONCAT(errnosav, __COUNTER__), _desc)
+
 typedef si_item_t *(*od_extract_t)(si_mod_t *si, xpc_object_t reply, const void *extra, uint64_t valid_global, uint64_t valid_cat);
 
 /* notify SPI */
@@ -119,6 +135,13 @@ _si_disable_opendirectory(void)
        _ds_port = MACH_PORT_NULL;
 }
 
+static void
+_li_auto_os_release(os_activity_t *activity)
+{
+       os_release(*activity);
+       (*activity) = NULL;
+}
+
 XPC_RETURNS_RETAINED
 static xpc_pipe_t
 _od_xpc_pipe(bool resetPipe)
@@ -416,52 +439,6 @@ _ds_is_valid(si_mod_t *si, si_item_t *item)
        return 1;
 }
 
-static void
-_free_addr_list(char **l)
-{
-       int i;
-
-       if (l == NULL) return;
-       for (i = 0; l[i] != NULL; i++) free(l[i]);
-       free(l);
-}
-
-/* map ipv4 addresses and append to v6 list */
-static int
-_map_v4(char ***v6, uint32_t n6, char **v4, uint32_t n4)
-{
-       struct in6_addr a6;
-       uint32_t i;
-
-       a6.__u6_addr.__u6_addr32[0] = 0x00000000;
-       a6.__u6_addr.__u6_addr32[1] = 0x00000000;
-       a6.__u6_addr.__u6_addr32[2] = htonl(0x0000ffff);
-
-       if (*v6 == NULL)
-       {
-               *v6 = (char **)calloc(n4 + 1, sizeof(char *));
-       }
-       else
-       {
-               *v6 = (char **)reallocf(*v6, (n6 + n4 + 1) * sizeof(char *));
-       }
-
-       if (*v6 == NULL) return -1;
-
-       for (i = 0; i < n4; i++)
-       {
-               (*v6)[n6] = (char *)calloc(1, IPV6_ADDR_LEN);
-               if ((*v6)[n6] == NULL) return -1;
-
-               memcpy(&(a6.__u6_addr.__u6_addr32[3]), v4[i], IPV4_ADDR_LEN);
-               memcpy((*v6)[n6], &(a6.__u6_addr.__u6_addr32[0]), IPV6_ADDR_LEN);
-
-               n6++;
-       }
-
-       return 0;
-}
-
 static xpc_object_t
 _xpc_query_key_string(const char *key, const char *value)
 {
@@ -1655,6 +1632,8 @@ ds_user_byname(si_mod_t *si, const char *name)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve User by Name");
+
        payload = _xpc_query_key_string("name", name);
        if (payload == NULL) return NULL;
 
@@ -1672,6 +1651,8 @@ ds_user_byuid(si_mod_t *si, uid_t uid)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve User by ID");
+
        payload = _xpc_query_key_id("uid", uid);
        if (payload == NULL) return NULL;
 
@@ -1689,6 +1670,8 @@ ds_user_byuuid(si_mod_t *si, uuid_t uuid)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve User by UUID");
+
        payload = _xpc_query_key_uuid("uuid", uuid);
        if (payload == NULL) return NULL;
 
@@ -1701,6 +1684,8 @@ ds_user_byuuid(si_mod_t *si, uuid_t uuid)
 static si_list_t *
 ds_user_all(si_mod_t *si)
 {
+       LI_OS_ACTIVITY("Performance Impact - Enumerate all users");
+
        return _ds_list(si, CATEGORY_USER, "getpwent", NULL, _extract_user);
 }
 
@@ -1712,6 +1697,8 @@ ds_group_byname(si_mod_t *si, const char *name)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve Group by Name");
+
        payload = _xpc_query_key_string("name", name);
        if (payload == NULL) return NULL;
 
@@ -1729,6 +1716,8 @@ ds_group_bygid(si_mod_t *si, gid_t gid)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve Group by ID");
+
        payload = _xpc_query_key_id("gid", gid);
        if (payload == NULL) return NULL;
 
@@ -1746,6 +1735,8 @@ ds_group_byuuid(si_mod_t *si, uuid_t uuid)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve Group by UUID");
+
        payload = _xpc_query_key_uuid("uuid", uuid);
        if (payload == NULL) return NULL;
 
@@ -1759,6 +1750,7 @@ static si_list_t *
 ds_group_all(si_mod_t *si)
 {
        if (!_od_running()) return NULL;
+       LI_OS_ACTIVITY("Performance Impact - Enumerate all Groups");
        return _ds_list(si, CATEGORY_GROUP, "getgrent", NULL, _extract_group);
 }
 
@@ -1767,10 +1759,19 @@ ds_grouplist(si_mod_t *si, const char *name, uint32_t ngroups)
 {
        xpc_object_t payload, reply;
        si_item_t *item = NULL;
+       os_activity_t activity;
 
        if (!_od_running()) return NULL;
        if (name == NULL) return NULL;
 
+       if (ngroups > 17) {
+               activity = os_activity_create("Performance impact - Resolve user group list (>17 groups)", OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+               os_log(OS_LOG_DEFAULT, "Too many groups requested (%u).  Can cause performance issues when network directories are involved", ngroups);
+       } else {
+               activity = os_activity_create("Resolve user group list", OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT);
+       }
+       os_activity_scope(activity);
+
        payload = xpc_dictionary_create(NULL, NULL, 0);
        if (payload == NULL) return NULL;
 
@@ -1800,6 +1801,7 @@ ds_grouplist(si_mod_t *si, const char *name, uint32_t ngroups)
        }
 
        xpc_release(payload);
+       os_release(activity);
 
        return item;
 }
@@ -1813,6 +1815,8 @@ ds_netgroup_byname(si_mod_t *si, const char *name)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve netgroup by name");
+
        payload = _xpc_query_key_string("netgroup", name);
        if (payload == NULL) return NULL;
 
@@ -1835,6 +1839,8 @@ ds_in_netgroup(si_mod_t *si, const char *group, const char *host, const char *us
 
        if (!_od_running()) return 0;
 
+       LI_OS_ACTIVITY("Match netgroup");
+
        payload = xpc_dictionary_create(NULL, NULL, 0);
        if (payload == NULL) return 0;
 
@@ -1864,6 +1870,7 @@ ds_alias_byname(si_mod_t *si, const char *name)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve alias by name");
        payload = _xpc_query_key_string("name", name);
        if (payload == NULL) return NULL;
 
@@ -1877,6 +1884,7 @@ static si_list_t *
 ds_alias_all(si_mod_t *si)
 {
        if (!_od_running()) return NULL;
+       LI_OS_ACTIVITY("Enumerate all alias entries");
        return _ds_list(si, CATEGORY_ALIAS, "alias_getent", NULL, _extract_alias);
 }
 
@@ -1888,6 +1896,7 @@ ds_network_byname(si_mod_t *si, const char *name)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve network by name");
        payload = _xpc_query_key_string("name", name);
        if (payload == NULL) return NULL;
 
@@ -1907,6 +1916,7 @@ ds_network_byaddr(si_mod_t *si, uint32_t addr)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve network by address");
        f1 = addr & 0xff;
        addr >>= 8;
        f2 = addr & 0xff;
@@ -1930,6 +1940,7 @@ static si_list_t *
 ds_network_all(si_mod_t *si)
 {
        if (!_od_running()) return NULL;
+       LI_OS_ACTIVITY("Emumerate all network entries");
        return _ds_list(si, CATEGORY_NETWORK, "getnetent", NULL, _extract_network);
 }
 
@@ -1944,6 +1955,8 @@ ds_service_byname(si_mod_t *si, const char *name, const char *proto)
        if (name == NULL) name = "";
        if (proto == NULL) proto = "";
 
+       LI_OS_ACTIVITY("Retrieve service by name");
+
        /* Check our local service cache (see ds_addrinfo). */
        item = pthread_getspecific(_ds_serv_cache_key);
        if (item != NULL)
@@ -1973,6 +1986,8 @@ ds_service_byport(si_mod_t *si, int port, const char *proto)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve service by port");
+
        payload = xpc_dictionary_create(NULL, NULL, 0);
        if (payload == NULL) return NULL;
 
@@ -1991,6 +2006,7 @@ static si_list_t *
 ds_service_all(si_mod_t *si)
 {
        if (!_od_running()) return NULL;
+       LI_OS_ACTIVITY("Enumerate all services");
        return _ds_list(si, CATEGORY_SERVICE, "getservent", NULL, _extract_service);
 }
 
@@ -2002,6 +2018,7 @@ ds_protocol_byname(si_mod_t *si, const char *name)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve protocol by name");
        payload = _xpc_query_key_string("name", name);
        if (payload == NULL) return NULL;
 
@@ -2019,6 +2036,7 @@ ds_protocol_bynumber(si_mod_t *si, int number)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve protocol by number");
        payload = _xpc_query_key_int("number", number);
        if (payload == NULL) return NULL;
 
@@ -2031,6 +2049,7 @@ ds_protocol_bynumber(si_mod_t *si, int number)
 static si_list_t *
 ds_protocol_all(si_mod_t *si)
 {
+       LI_OS_ACTIVITY("Enumerate all protocols");
        return _ds_list(si, CATEGORY_PROTOCOL, "getprotoent", NULL, _extract_protocol);
 }
 
@@ -2042,6 +2061,7 @@ ds_rpc_byname(si_mod_t *si, const char *name)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve RPC by name");
        payload = _xpc_query_key_string("name", name);
        if (payload == NULL) return NULL;
 
@@ -2059,6 +2079,7 @@ ds_rpc_bynumber(si_mod_t *si, int number)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve RPC by number");
        payload = _xpc_query_key_int("number", number);
        if (payload == NULL) return NULL;
 
@@ -2071,6 +2092,7 @@ ds_rpc_bynumber(si_mod_t *si, int number)
 static si_list_t *
 ds_rpc_all(si_mod_t *si)
 {
+       LI_OS_ACTIVITY("Enumerate all RPC entries");
        return _ds_list(si, CATEGORY_RPC, "getrpcent", NULL, _extract_rpc);
 }
 
@@ -2082,6 +2104,7 @@ ds_fs_byspec(si_mod_t *si, const char *name)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Lookup FS entry by spec");
        payload = _xpc_query_key_string("name", name);
        if (payload == NULL) return NULL;
 
@@ -2094,6 +2117,7 @@ ds_fs_byspec(si_mod_t *si, const char *name)
 static si_list_t *
 ds_fs_all(si_mod_t *si)
 {
+       LI_OS_ACTIVITY("Performance impact - Enumerate all FS entries");
        return _ds_list(si, CATEGORY_FS, "getfsent", NULL, _extract_fstab);
 }
 
@@ -2108,6 +2132,7 @@ ds_fs_byfile(si_mod_t *si, const char *name)
        if (!_od_running()) return NULL;
        if (name == NULL) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve FS by file location");
        list = ds_fs_all(si);
        if (list == NULL) return NULL;
 
@@ -2130,6 +2155,7 @@ ds_mac_byname(si_mod_t *si, const char *name)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve FS by name");
        payload = _xpc_query_key_string("name", name);
        if (payload == NULL) return NULL;
 
@@ -2148,6 +2174,7 @@ ds_mac_bymac(si_mod_t *si, const char *mac)
 
        if (!_od_running()) return NULL;
 
+       LI_OS_ACTIVITY("Retrieve MAC entry by MAC");
        cmac = si_standardize_mac_address(mac);
        if (cmac == NULL) return NULL;
 
index 2e9969edfd72d505d1bd3598b0c5abbfb8bf50ab..57b1d906c7a4bdb8044bdbe550b76b7a5b05a478 100644 (file)
@@ -341,18 +341,18 @@ _fsi_get_validation(si_mod_t *si, int vtype, const char *path, FILE *f, uint64_t
 static int
 _fsi_validate(si_mod_t *si, int cat, uint64_t va, uint64_t vb)
 {
+#if !TARGET_OS_EMBEDDED
        struct stat sb;
        const char *path;
        uint32_t item_val, curr_val, vtype;
        file_si_private_t *pp;
        int status;
+#endif
 
        if (si == NULL) return 0;
 
-#if TARGET_OS_EMBEDDED
+#if !TARGET_OS_EMBEDDED
        /* /etc is on a read-only filesystem, so no validation is required */
-       return 1;
-#endif
 
        pp = (file_si_private_t *)si->private;
        if (pp == NULL) return 0;
@@ -449,6 +449,7 @@ _fsi_validate(si_mod_t *si, int cat, uint64_t va, uint64_t vb)
                curr_val = ntohl(curr_val);
                if (item_val != curr_val) return 0;
        }
+#endif
 
        return 1;
 }
@@ -1863,6 +1864,7 @@ _fsi_fs_root(si_mod_t *si)
                root_spec = _fsi_get_device_path(rootstat.st_dev);
 
                rootfs = (si_item_t *)LI_ils_create("L4488sssss44", (unsigned long)si, CATEGORY_FS, 1, 0LL, 0LL, root_spec, root_path, rootfsinfo.f_fstypename, FSTAB_RW, FSTAB_RW, 0, 1);
+               free(root_spec);
        });
 
        return si_item_retain(rootfs);
index bf8566eeb1efcd597086978e947ce8f068ba0b11..f77d3825ab86c91d339f97ac93a677b4059fee50 100644 (file)
@@ -151,7 +151,7 @@ variants detailed below.
 The
 .Fn getpwent
 function
-searches all available directory services on it's first invocation.
+searches all available directory services on its first invocation.
 It caches the returned entries in a list
 and returns user account entries one at a time.
 .Pp
old mode 100644 (file)
new mode 100755 (executable)
index 6b5a50d..93921cc
@@ -48,6 +48,8 @@
 #define IPV6_ADDR_LEN 16
 #define IPV4_ADDR_LEN 4
 
+#define SYSTEM_UID_LIMIT 500
+
 /* kernel syscalls */
 extern int __initgroups(u_int gidsetsize, gid_t *gidset, int gmuid);
 
@@ -76,6 +78,16 @@ typedef struct
        int32_t key_offset;
 } si_context_t;
 
+si_mod_t *
+si_search_file(void)
+{
+       static si_mod_t *search = NULL;
+
+       if (search == NULL) search = si_module_with_name("file");
+
+       return search;
+}
+
 si_mod_t *
 si_search(void)
 {
@@ -232,14 +244,20 @@ getpwnam_async_handle_reply(mach_msg_header_t *msg)
 struct passwd *
 getpwuid(uid_t uid)
 {
-       si_item_t *item;
+       si_item_t *item = NULL;
     
 #ifdef CALL_TRACE
        fprintf(stderr, "-> %s %d\n", __func__, uid);
 #endif
-    
-    
-    item = si_user_byuid(si_search(), uid);
+
+       // Search the file module first for all system uids
+       // (ie, uid value < 500) since they should all be
+       // in the /etc/*passwd file.
+       if (uid < SYSTEM_UID_LIMIT)
+               item = si_user_byuid(si_search_file(), uid);
+
+       if (item == NULL)
+               item = si_user_byuid(si_search(), uid);
        LI_set_thread_item(CATEGORY_USER + 200, item);
 
        if (item == NULL) return NULL;
@@ -263,6 +281,19 @@ getpwuid_async_call(uid_t uid, si_user_async_callback callback, void *context)
        sictx->cat = CATEGORY_USER;
        sictx->key_offset = 200;
 
+       // Search the file module first for all system uids
+       // (ie, uid value < 500) since they should all be
+       // in the /etc/*passwd file.
+       if (uid < SYSTEM_UID_LIMIT)
+       {
+               si_item_t *item = si_user_byuid(si_search_file(), uid);
+               if (item)
+               {
+                       si_item_release(item);
+                       return si_async_call(si_search_file(), SI_CALL_USER_BYUID, NULL, NULL, NULL, (uint32_t)uid, 0, 0, 0, (void *)si_libinfo_general_callback, sictx);
+               }
+       }
+
        return si_async_call(si_search(), SI_CALL_USER_BYUID, NULL, NULL, NULL, (uint32_t)uid, 0, 0, 0, (void *)si_libinfo_general_callback, sictx);
 }
 
@@ -611,6 +642,8 @@ _check_groups(const char *function, int32_t ngroups)
        dispatch_once(&once, ^(void) {
                const char *proc_name = getprogname();
                if (strcmp(proc_name, "id") != 0 && strcmp(proc_name, "smbd") != 0 && strcmp(proc_name, "rpcsvchost") != 0) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
                        aslmsg msg = asl_new(ASL_TYPE_MSG);
                        char buffer[256];
 
@@ -625,6 +658,7 @@ _check_groups(const char *function, int32_t ngroups)
 
                        asl_free(msg);
                }
+#pragma clang diagnostic pop
        });
 }
 #endif
@@ -3158,10 +3192,9 @@ getpwnam_r(const char *name, struct passwd *pw, char *buffer, size_t bufsize, st
 int
 getpwuid_r(uid_t uid, struct passwd *pw, char *buffer, size_t bufsize, struct passwd **result)
 {
-       si_item_t *item;
+       si_item_t *item = NULL;
        struct passwd *p;
        int status;
-    uid_t localuid = uid;
 
 #ifdef CALL_TRACE
        fprintf(stderr, "-> %s %d\n", __func__, uid);
@@ -3171,7 +3204,14 @@ getpwuid_r(uid_t uid, struct passwd *pw, char *buffer, size_t bufsize, struct pa
 
        if ((pw == NULL) || (buffer == NULL) || (result == NULL) || (bufsize == 0)) return ERANGE;
     
-       item = si_user_byuid(si_search(), localuid);
+       // Search the file module first for all system uids
+       // (ie, uid value < 500) since they should all be
+       // in the /etc/*passwd file.
+       if (uid < SYSTEM_UID_LIMIT)
+               item = si_user_byuid(si_search_file(), uid);
+
+       if (item == NULL)
+               item = si_user_byuid(si_search(), uid);
        if (item == NULL) return 0;
 
        p = (struct passwd *)((uintptr_t)item + sizeof(si_item_t));
index 6b618d7929fada467ff14313f375c0e1d7409a85..af65bffd3ed0d9a2eacef67c37c51f4cd818f3af 100644 (file)
 #include <net/if.h>
 #include <time.h>
 #include <unistd.h>
-#include <asl.h>
+#include <os/log.h>
 #include <dns.h>
 #include <dns_util.h>
 #include <TargetConditionals.h>
@@ -222,7 +222,7 @@ _mdns_debug_message(const char *str, ...)
 
        if (_mdns_debug & MDNS_DEBUG_STDOUT) fprintf(stdout, "%s", out);
        if (_mdns_debug & MDNS_DEBUG_STDERR) fprintf(stderr, "%s", out);
-       if (_mdns_debug & MDNS_DEBUG_ASL) asl_log_message(ASL_LEVEL_NOTICE, "%s", out);
+       if (_mdns_debug & MDNS_DEBUG_ASL) os_log(OS_LOG_DEFAULT, "%s", out);
        free(out);
 
        va_end(v);
@@ -1665,7 +1665,7 @@ _mdns_search(const char *name, int class, int type, const char *interface, DNSSe
 
 #if TARGET_OS_EMBEDDED
        /* log a warning for queries from the main thread */
-       if (pthread_is_threaded_np() && pthread_main_np()) asl_log(NULL, NULL, ASL_LEVEL_WARNING, "Warning: Libinfo call to mDNSResponder on main thread");
+       if (pthread_is_threaded_np() && pthread_main_np()) os_log(OS_LOG_DEFAULT, "Warning: Libinfo call to mDNSResponder on main thread");
 #endif /* TARGET_OS_EMBEDDED */
 
        /*
index 5749b06e98886f08df5c2e0b7dbb5101257458bf..762d465db296ac09260224cbccadfc4cee666719 100644 (file)
@@ -244,6 +244,7 @@ struct rpcent {
 #define        NI_NUMERICHOST  0x00000002
 #define        NI_NAMEREQD     0x00000004
 #define        NI_NUMERICSERV  0x00000008
+#define        NI_NUMERICSCOPE 0x00000100
 #define        NI_DGRAM        0x00000010
 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
 #define NI_WITHSCOPEID 0x00000020
index 5278077bb406e2218a53583579ff5c54b7baabcb..d93aafda028762121b253dec8345b9c24c8fc66a 100644 (file)
@@ -63,7 +63,7 @@ si_list_t *
 si_list_concat(si_list_t *l, si_list_t *x)
 {
        si_item_t *item;
-       uint32_t newcount;
+       size_t newcount;
        size_t size;
        int i;
 
@@ -77,7 +77,7 @@ si_list_concat(si_list_t *l, si_list_t *x)
 
        if (l != NULL)
        {
-               newcount = l->count + x->count;
+               newcount = (size_t)l->count + (size_t)x->count;
                size = newcount * sizeof(si_item_t *);
 
                l->entry = (si_item_t **)reallocf(l->entry, size);
index 6f4b6cf46c6b245a42738ccd6b645dca8fab4b43..e678d96d0c2c30697e5ab43c648764477dbfc9c3 100644 (file)
@@ -34,6 +34,7 @@
 #ifdef DS_AVAILABLE
 #include <xpc/xpc.h>
 #include <xpc/private.h>
+#include <os/activity.h>
 #include <opendirectory/odipc.h>
 #include <pthread.h>
 #include <mach-o/dyld_priv.h>
@@ -44,6 +45,14 @@ static const uuid_t _group_compat_prefix = {0xab, 0xcd, 0xef, 0xab, 0xcd, 0xef,
 
 #define COMPAT_PREFIX_LEN      (sizeof(uuid_t) - sizeof(id_t))
 
+#if DS_AVAILABLE
+#define MBR_OS_ACTIVITY(_desc) \
+       os_activity_t activity __attribute__((__cleanup__(_mbr_auto_os_release))) = os_activity_create(_desc, OS_ACTIVITY_CURRENT, OS_ACTIVITY_FLAG_DEFAULT); \
+       os_activity_scope(activity)
+#else
+#define MBR_OS_ACTIVITY(_desc)
+#endif
+
 #ifdef DS_AVAILABLE
 
 int _si_opendirectory_disabled;
@@ -85,6 +94,13 @@ _mbr_fork_parent(void)
 #endif
 
 #ifdef DS_AVAILABLE
+static void
+_mbr_auto_os_release(os_activity_t *activity)
+{
+       os_release(*activity);
+       (*activity) = NULL;
+}
+
 XPC_RETURNS_RETAINED
 static xpc_pipe_t
 _mbr_xpc_pipe(bool resetPipe)
@@ -166,6 +182,7 @@ parse_compatibility_uuid(const uuid_t uu, id_t *result, int *rec_type)
        return false;
 }
 
+#if !DS_AVAILABLE
 static bool
 compatibility_name_for_id(id_t id, int rec_type, char **result)
 {
@@ -212,6 +229,7 @@ compatibility_name_for_uuid(const uuid_t uu, char **result, int *rec_type)
                return false;
        }
 }
+#endif
 
 int
 mbr_identifier_translate(int id_type, const void *identifier, size_t identifier_size, int target_type, void **result, int *rec_type)
@@ -224,7 +242,7 @@ mbr_identifier_translate(int id_type, const void *identifier, size_t identifier_
        int rc = EIO;
        
        if (identifier == NULL || result == NULL || identifier_size == 0) return EIO;
-       
+
        if (identifier_size == -1) {
                identifier_size = strlen(identifier);
        } else {
@@ -343,7 +361,9 @@ mbr_identifier_translate(int id_type, const void *identifier, size_t identifier_
 #if DS_AVAILABLE
        payload = xpc_dictionary_create(NULL, NULL, 0);
        if (payload == NULL) return EIO;
-       
+
+       MBR_OS_ACTIVITY("Membership API: translate identifier");
+
        xpc_dictionary_set_int64(payload, "requesting", target_type);
        xpc_dictionary_set_int64(payload, "type", id_type);
        xpc_dictionary_set_data(payload, "identifier", identifier, identifier_size);
@@ -550,7 +570,8 @@ mbr_check_membership_ext(int userid_type, const void *userid, size_t userid_size
 #ifdef DS_AVAILABLE
        xpc_object_t payload, reply;
        int rc = 0;
-       
+
+       MBR_OS_ACTIVITY("Membership API: Validating user is a member of group");
        payload = xpc_dictionary_create(NULL, NULL, 0);
        if (payload == NULL) return ENOMEM;
 
@@ -611,6 +632,7 @@ int
 mbr_reset_cache()
 {
 #ifdef DS_AVAILABLE
+       MBR_OS_ACTIVITY("Membership API: Flush the membership cache");
        _od_rpc_call("mbr_cache_flush", NULL, _mbr_xpc_pipe);
        return 0;
 #else
@@ -641,7 +663,9 @@ mbr_check_service_membership(const uuid_t user, const char *servicename, int *is
        
        payload = xpc_dictionary_create(NULL, NULL, 0);
        if (payload == NULL) return EIO;
-       
+
+       MBR_OS_ACTIVITY("Membership API: Validating user is allowed by service");
+
        xpc_dictionary_set_data(payload, "user_id", user, sizeof(uuid_t));
        xpc_dictionary_set_int64(payload, "user_idtype", ID_TYPE_UUID);
        xpc_dictionary_set_string(payload, "service", servicename);
@@ -789,7 +813,9 @@ mbr_set_identifier_ttl(int id_type, const void *identifier, size_t identifier_si
        
        payload = xpc_dictionary_create(NULL, NULL, 0);
        if (payload == NULL) return ENOMEM;
-       
+
+       MBR_OS_ACTIVITY("Membership API: Change the TTL of a given identifier in SystemCache");
+
        xpc_dictionary_set_int64(payload, "type", id_type);
        xpc_dictionary_set_data(payload, "identifier", identifier, identifier_size);
        xpc_dictionary_set_int64(payload, "ttl", seconds);
index 2aee38943e37d82a401136d1424544b820ffb9aa..2eee25c372c80ae837cc13a8238ae34d05537a79 100644 (file)
@@ -407,8 +407,7 @@ svctcp_recv(xprt, msg)
        register XDR *xdrs = &(cd->xdrs);
 
        xdrs->x_op = XDR_DECODE;
-       (void)xdrrec_skiprecord(xdrs);
-       if (xdr_callmsg(xdrs, msg)) {
+       if (xdrrec_skiprecord(xdrs) && xdr_callmsg(xdrs, msg)) {
                cd->x_id = msg->rm_xid;
                return (TRUE);
        }
index bb447ff93adb6773bebaefff5ea5fb10bfaa0c9b..e99d936d593148dc5703bd4863599a23ade196ec 100644 (file)
@@ -1,3 +1,5 @@
+#include "<DEVELOPER_DIR>/Makefiles/CoreOS/Xcode/BSD.xcconfig"
+
 HEADER_SEARCH_PATHS = /usr/local/include $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
 INSTALLHDRS_SCRIPT_PHASE = YES
 SDKROOT = macosx.internal
@@ -5,14 +7,20 @@ SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator
 
 GCC_PREPROCESSOR_DEFINITIONS = __DARWIN_NON_CANCELABLE=1 __MigTypeCheck=1 INET6=1
 GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*] = MUSER_AVAILABLE $(GCC_PREPROCESSOR_DEFINITIONS)
+GCC_PREPROCESSOR_DEFINITIONS[sdk=watchos*] = MUSER_AVAILABLE $(GCC_PREPROCESSOR_DEFINITIONS)
+GCC_PREPROCESSOR_DEFINITIONS[sdk=appletvos*] = MUSER_AVAILABLE $(GCC_PREPROCESSOR_DEFINITIONS)
 GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*] = CONFIG_MAC DS_AVAILABLE SYNTH_ROOTFS $(GCC_PREPROCESSOR_DEFINITIONS)
 
+BUILD_VARIANTS = normal profile debug
+
 INSTALL_PATH = /usr/lib/system
 
 EXECUTABLE_PREFIX = libsystem_
 
 ORDER_FILE[sdk=macosx*] = $(SDKROOT)/$(APPLE_INTERNAL_DIR)/OrderFiles/libsystem_info.order
 ORDER_FILE[sdk=iphoneos*] = $(SDKROOT)/$(APPLE_INTERNAL_DIR)/OrderFiles/libsystem_info.order
+ORDER_FILE[sdk=watchos*] = $(SDKROOT)/$(APPLE_INTERNAL_DIR)/OrderFiles/libsystem_info.order
+ORDER_FILE[sdk=appletvos*] = $(SDKROOT)/$(APPLE_INTERNAL_DIR)/OrderFiles/libsystem_info.order
 
 LINK_WITH_STANDARD_LIBRARIES = NO
 
@@ -34,5 +42,37 @@ LIBDNSD_LDFLAGS = -lsystem_dnssd
 LIBNOTIFY_LDFLAGS = -lsystem_notify
 LIBXPC_LDFLAGS = -lxpc
 LIBNETWORK_LDFLAGS = -lsystem_network
+LIBTRACE_LDFLAGS = -lsystem_trace
+
+CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
+CLANG_WARN_BOOL_CONVERSION = YES;
+CLANG_WARN_CONSTANT_CONVERSION = YES;
+CLANG_WARN_EMPTY_BODY = YES;
+CLANG_WARN_ENUM_CONVERSION = YES;
+CLANG_WARN_INFINITE_RECURSION = YES;
+CLANG_WARN_INT_CONVERSION = YES;
+CLANG_WARN_SUSPICIOUS_MOVE = YES;
+CLANG_WARN_UNREACHABLE_CODE = YES;
+CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+GCC_NO_COMMON_BLOCKS = YES;
+GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
+GCC_WARN_ABOUT_RETURN_TYPE = YES;
+GCC_WARN_UNDECLARED_SELECTOR = YES;
+GCC_WARN_UNINITIALIZED_AUTOS = YES;
+GCC_WARN_UNUSED_VARIABLE = YES;
+WARNING_LDFLAGS = -Wall
+WARNING_CFLAGS = -Wno-error=deprecated-declarations
+GCC_WARN_UNUSED_FUNCTION = YES
+
+GCC_C_LANGUAGE_STANDARD = gnu99;
+ENABLE_STRICT_OBJC_MSGSEND = YES;
+
+//:configuration = Debug
+GCC_OPTIMIZATION_LEVEL = 0
+OTHER_CFLAGS = -DDEBUG=1
+//:completeSettings = none
+
+DYLIB_COMPATIBILITY_VERSION = 1
 
-OTHER_LDFLAGS = -all_load -umbrella System -L/usr/lib/system $(LIBCOMPILER_RT_LDFLAGS) $(LIBDYLD_LDFLAGS) $(LIBSYSCALL_LDFLAGS) $(LIBMALLOC_LDFLAGS) $(LIBPLATFORM_LDFLAGS) $(LIBPTHREAD_LDFLAGS) $(LIBC_LDFLAGS) $(LIBDISPATCH_LDFLAGS) $(LIBLAUNCH_LDFLAGS) $(LIBASL_LDFLAGS) $(LIBBLOCKS_LDFLAGS) $(LIBDNSD_LDFLAGS) $(LIBNOTIFY_LDFLAGS) $(LIBXPC_LDFLAGS) $(LIBNETWORK_LDFLAGS)
+OTHER_LDFLAGS = -all_load -umbrella System -L/usr/lib/system $(LIBCOMPILER_RT_LDFLAGS) $(LIBDYLD_LDFLAGS) $(LIBSYSCALL_LDFLAGS) $(LIBMALLOC_LDFLAGS) $(LIBPLATFORM_LDFLAGS) $(LIBPTHREAD_LDFLAGS) $(LIBC_LDFLAGS) $(LIBDISPATCH_LDFLAGS) $(LIBLAUNCH_LDFLAGS) $(LIBASL_LDFLAGS) $(LIBBLOCKS_LDFLAGS) $(LIBDNSD_LDFLAGS) $(LIBNOTIFY_LDFLAGS) $(LIBXPC_LDFLAGS) $(LIBNETWORK_LDFLAGS) $(LIBTRACE_LDFLAGS)