openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/libpam/1.3.1-r0/Linux-PAM-1.3.1/modules/pam_access/pam_access.c
static int netgroup_match(pam_handle_t* pamh, const char* netgroup,
                          const char* machine, const char* user, int debug)
{
    int retval;
    char* mydomain = NULL;
    char domainname_res[256];

    if (getdomainname(domainname_res, sizeof(domainname_res)) == 0)
    {
        if (domainname_res[0] != '\0' && strcmp(domainname_res, "(none)") != 0)
        {
            mydomain = domainname_res;
        }
    }

#ifdef HAVE_INNETGR
    retval = innetgr(netgroup, machine, user, mydomain);
#else
    retval = 0;
    pam_syslog(pamh, LOG_ERR, "pam_access does not have netgroup support");
#endif
    if (debug == YES)
        pam_syslog(
            pamh, LOG_DEBUG,
            "netgroup_match: %d (netgroup=%s, machine=%s, user=%s, domain=%s)",
            retval, netgroup ? netgroup : "NULL", machine ? machine : "NULL",
            user ? user : "NULL", mydomain ? mydomain : "NULL");
    return retval;
}
/* netgroup_match - match group against machine or user */
match group against machine or user
match group against machine or user
static int netgroup_match(pam_handle_t* pamh, const char* netgroup,
                          const char* machine, const char* user, int debug)
{
    int retval;
    char* mydomain = NULL;
    char domainname_res[256];
    if (getdomainname(domainname_res, sizeof(domainname_res)) == 0)
    {
        if (domainname_res[0] != '\0' && strcmp(domainname_res, "(none)") != 0)
        {
            mydomain = domainname_res;
        }
    }
#ifdef HAVE_INNETGR
    retval = innetgr(netgroup, machine, user, mydomain);
#else
    retval = 0;
    pam_syslog(pamh, LOG_ERR, "pam_access does not have netgroup support");
#endif
    if (debug == YES)
        pam_syslog(
            pamh, LOG_DEBUG,
            "netgroup_match: %d (netgroup=%s, machine=%s, user=%s, domain=%s)",
            retval, netgroup ? netgroup : "NULL", machine ? machine : "NULL",
            user ? user : "NULL", mydomain ? mydomain : "NULL");
    return retval;
}
static int netgroup_match ( pam_handle_t * pamh , const char * netgroup , const char * machine , const char * user , int debug ) { int retval ; char * mydomain = NULL ; char domainname_res [ 256 ] ; if ( getdomainname ( domainname_res , sizeof ( domainname_res ) ) == 0 ) { if ( domainname_res [ 0 ] != ' \0 ' && strcmp ( domainname_res , " " ) != 0 ) { mydomain = domainname_res ; } } #ifdef HAVE_INNETGR retval = innetgr ( netgroup , machine , user , mydomain ) ; #else retval = 0 ; pam_syslog ( pamh , LOG_ERR , " " ) ; #endif if ( debug == YES ) pam_syslog ( pamh , LOG_DEBUG , " " , retval , netgroup ? netgroup : " " , machine ? machine : " " , user ? user : " " , mydomain ? mydomain : " " ) ; return retval ; }
netgroup_match - match group against machine or user
netgroup_match - match group against machine or user