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/myldap.c
const char* myldap_get_dn(MYLDAP_ENTRY* entry)
{
    int rc;
    /* check parameters */
    if (!is_valid_entry(entry))
    {
        log_log(LOG_ERR, "myldap_get_dn(): invalid result entry passed");
        errno = EINVAL;
        return "unknown";
    }
    /* if we don't have it yet, retreive it */
    if ((entry->dn == NULL) && (entry->search->valid))
    {
        entry->dn = ldap_get_dn(entry->search->session->ld, entry->search->msg);
        if (entry->dn == NULL)
        {
            if (ldap_get_option(entry->search->session->ld,
                                LDAP_OPT_ERROR_NUMBER, &rc) != LDAP_SUCCESS)
                rc = LDAP_UNAVAILABLE;
            myldap_err(LOG_WARNING, entry->search->session->ld, rc,
                       "ldap_get_dn() returned NULL");
            /* close connection on connection problems */
            if ((rc == LDAP_UNAVAILABLE) || (rc == LDAP_SERVER_DOWN))
                do_close(entry->search->session);
        }
    }
    /* if we still don't have it, return unknown */
    if (entry->dn == NULL)
        return "unknown";
    /* return it */
    return entry->dn;
}
/* Get the DN from the entry. This function only returns NULL (and sets
   errno) if an incorrect entry is passed. If the DN value cannot be
   retrieved "unknown" is returned instead. */
Get the DN from the entry. This function only returns NULL (and sets
errno) if an incorrect entry is passed. If the DN value cannot be
retrieved "unknown" is returned instead.
Get the DN from the entry . This function only returns NULL ( and sets errno ) if an incorrect entry is passed . If the DN value cannot be retrieved " unknown " is returned instead .
const char* myldap_get_dn(MYLDAP_ENTRY* entry)
{
    int rc;
    if (!is_valid_entry(entry))
    {
        log_log(LOG_ERR, "myldap_get_dn(): invalid result entry passed");
        errno = EINVAL;
        return "unknown";
    }
    if ((entry->dn == NULL) && (entry->search->valid))
    {
        entry->dn = ldap_get_dn(entry->search->session->ld, entry->search->msg);
        if (entry->dn == NULL)
        {
            if (ldap_get_option(entry->search->session->ld,
                                LDAP_OPT_ERROR_NUMBER, &rc) != LDAP_SUCCESS)
                rc = LDAP_UNAVAILABLE;
            myldap_err(LOG_WARNING, entry->search->session->ld, rc,
                       "ldap_get_dn() returned NULL");
            if ((rc == LDAP_UNAVAILABLE) || (rc == LDAP_SERVER_DOWN))
                do_close(entry->search->session);
        }
    }
    if (entry->dn == NULL)
        return "unknown";
    return entry->dn;
}
const char * myldap_get_dn ( MYLDAP_ENTRY * entry ) { int rc ; if ( ! is_valid_entry ( entry ) ) { log_log ( LOG_ERR , " " ) ; errno = EINVAL ; return " " ; } if ( ( entry -> dn == NULL ) && ( entry -> search -> valid ) ) { entry -> dn = ldap_get_dn ( entry -> search -> session -> ld , entry -> search -> msg ) ; if ( entry -> dn == NULL ) { if ( ldap_get_option ( entry -> search -> session -> ld , LDAP_OPT_ERROR_NUMBER , & rc ) != LDAP_SUCCESS ) rc = LDAP_UNAVAILABLE ; myldap_err ( LOG_WARNING , entry -> search -> session -> ld , rc , " " ) ; if ( ( rc == LDAP_UNAVAILABLE ) || ( rc == LDAP_SERVER_DOWN ) ) do_close ( entry -> search -> session ) ; } } if ( entry -> dn == NULL ) return " " ; return entry -> dn ; }
Get the DN from the entry.
Get the DN from the entry .
/* check parameters */ /* if we don't have it yet, retreive it */ /* close connection on connection problems */ /* if we still don't have it, return unknown */ /* return it */