openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/nss-pam-ldapd/0.9.8-r0/nss-pam-ldapd-0.9.8/nslcd/group.c
static int mkfilter_group_bygid(gid_t gid, char* buffer, size_t buflen)
{
    gid -= nslcd_cfg->nss_gid_offset;
    /* if searching for a Windows domain SID */
    if (gidSid != NULL)
    {
        /* the given gid is a BUILTIN gid, the SID prefix is not the domain SID
         */
        if ((gid >= min_builtin_rid) && (gid <= max_builtin_rid))
            return mysnprintf(
                buffer, buflen, "(&%s(%s=%s\\%02x\\%02x\\%02x\\%02x))",
                group_filter, attmap_group_gidNumber, builtinSid,
                (int)(gid & 0xff), (int)((gid >> 8) & 0xff),
                (int)((gid >> 16) & 0xff), (int)((gid >> 24) & 0xff));
        return mysnprintf(buffer, buflen,
                          "(&%s(%s=%s\\%02x\\%02x\\%02x\\%02x))", group_filter,
                          attmap_group_gidNumber, gidSid, (int)(gid & 0xff),
                          (int)((gid >> 8) & 0xff), (int)((gid >> 16) & 0xff),
                          (int)((gid >> 24) & 0xff));
    }
    else
    {
        return mysnprintf(buffer, buflen, "(&%s(%s=%lu))", group_filter,
                          attmap_group_gidNumber, (unsigned long int)gid);
    }
}
/* create a search filter for searching a group entry
   by gid, return -1 on errors */
create a search filter for searching a group entry
by gid, return -1 on errors
create a search filter for searching a group entry by gid return - 1 on errors
static int mkfilter_group_bygid(gid_t gid, char* buffer, size_t buflen)
{
    gid -= nslcd_cfg->nss_gid_offset;
    if (gidSid != NULL)
    {
        if ((gid >= min_builtin_rid) && (gid <= max_builtin_rid))
            return mysnprintf(
                buffer, buflen, "(&%s(%s=%s\\%02x\\%02x\\%02x\\%02x))",
                group_filter, attmap_group_gidNumber, builtinSid,
                (int)(gid & 0xff), (int)((gid >> 8) & 0xff),
                (int)((gid >> 16) & 0xff), (int)((gid >> 24) & 0xff));
        return mysnprintf(buffer, buflen,
                          "(&%s(%s=%s\\%02x\\%02x\\%02x\\%02x))", group_filter,
                          attmap_group_gidNumber, gidSid, (int)(gid & 0xff),
                          (int)((gid >> 8) & 0xff), (int)((gid >> 16) & 0xff),
                          (int)((gid >> 24) & 0xff));
    }
    else
    {
        return mysnprintf(buffer, buflen, "(&%s(%s=%lu))", group_filter,
                          attmap_group_gidNumber, (unsigned long int)gid);
    }
}
static int mkfilter_group_bygid ( gid_t gid , char * buffer , size_t buflen ) { gid -= nslcd_cfg -> nss_gid_offset ; if ( gidSid != NULL ) { if ( ( gid >= min_builtin_rid ) && ( gid <= max_builtin_rid ) ) return mysnprintf ( buffer , buflen , " \\ \\ \\ \\ " , group_filter , attmap_group_gidNumber , builtinSid , ( int ) ( gid & 0xff ) , ( int ) ( ( gid >> 8 ) & 0xff ) , ( int ) ( ( gid >> 16 ) & 0xff ) , ( int ) ( ( gid >> 24 ) & 0xff ) ) ; return mysnprintf ( buffer , buflen , " \\ \\ \\ \\ " , group_filter , attmap_group_gidNumber , gidSid , ( int ) ( gid & 0xff ) , ( int ) ( ( gid >> 8 ) & 0xff ) , ( int ) ( ( gid >> 16 ) & 0xff ) , ( int ) ( ( gid >> 24 ) & 0xff ) ) ; } else { return mysnprintf ( buffer , buflen , " " , group_filter , attmap_group_gidNumber , ( unsigned long int ) gid ) ; } }
create a search filter for searching a group entry
by gid, return -1 on errors
create a search filter for searching a group entry by gid return - 1 on errors
/* if searching for a Windows domain SID */ /* the given gid is a BUILTIN gid, the SID prefix is not the domain SID
         */