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/rpc.c
static int write_rpc(TFILE* fp, MYLDAP_ENTRY* entry, const char* reqname)
{
    int32_t tmpint32, tmp2int32, tmp3int32;
    const char* name;
    const char** aliases;
    const char** numbers;
    char* tmp;
    unsigned long number;
    int i;
    /* get the most canonical name */
    name = myldap_get_rdn_value(entry, attmap_rpc_cn);
    /* get the other names for the rpc entries */
    aliases = myldap_get_values(entry, attmap_rpc_cn);
    if ((aliases == NULL) || (aliases[0] == NULL))
    {
        log_log(LOG_WARNING, "%s: %s: missing", myldap_get_dn(entry),
                attmap_rpc_cn);
        return 0;
    }
    /* if the rpc name is not yet found, get the first entry */
    if (name == NULL)
        name = aliases[0];
    /* check case of returned rpc entry */
    if ((reqname != NULL) && (STR_CMP(reqname, name) != 0))
    {
        for (i = 0; (aliases[i] != NULL) && (STR_CMP(reqname, aliases[i]) != 0);
             i++)
            /* nothing */;
        if (aliases[i] == NULL)
            return 0; /* neither the name nor any of the aliases matched */
    }
    /* get the rpc number */
    numbers = myldap_get_values(entry, attmap_rpc_oncRpcNumber);
    if ((numbers == NULL) || (numbers[0] == NULL))
    {
        log_log(LOG_WARNING, "%s: %s: missing", myldap_get_dn(entry),
                attmap_rpc_oncRpcNumber);
        return 0;
    }
    else if (numbers[1] != NULL)
    {
        log_log(LOG_WARNING, "%s: %s: multiple values", myldap_get_dn(entry),
                attmap_rpc_oncRpcNumber);
    }
    errno = 0;
    number = strtol(numbers[0], &tmp, 10);
    if ((*(numbers[0]) == '\0') || (*tmp != '\0'))
    {
        log_log(LOG_WARNING, "%s: %s: non-numeric", myldap_get_dn(entry),
                attmap_rpc_oncRpcNumber);
        return 0;
    }
    else if ((errno != 0) || (number > UINT32_MAX))
    {
        log_log(LOG_WARNING, "%s: %s: out of range", myldap_get_dn(entry),
                attmap_rpc_oncRpcNumber);
        return 0;
    }
    /* write the entry */
    WRITE_INT32(fp, NSLCD_RESULT_BEGIN);
    WRITE_STRING(fp, name);
    WRITE_STRINGLIST_EXCEPT(fp, aliases, name);
    WRITE_INT32(fp, number);
    return 0;
}
/* write a single rpc entry to the stream */
write a single rpc entry to the stream
write a single rpc entry to the stream
static int write_rpc(TFILE* fp, MYLDAP_ENTRY* entry, const char* reqname)
{
    int32_t tmpint32, tmp2int32, tmp3int32;
    const char* name;
    const char** aliases;
    const char** numbers;
    char* tmp;
    unsigned long number;
    int i;
    name = myldap_get_rdn_value(entry, attmap_rpc_cn);
    aliases = myldap_get_values(entry, attmap_rpc_cn);
    if ((aliases == NULL) || (aliases[0] == NULL))
    {
        log_log(LOG_WARNING, "%s: %s: missing", myldap_get_dn(entry),
                attmap_rpc_cn);
        return 0;
    }
    if (name == NULL)
        name = aliases[0];
    if ((reqname != NULL) && (STR_CMP(reqname, name) != 0))
    {
        for (i = 0; (aliases[i] != NULL) && (STR_CMP(reqname, aliases[i]) != 0);
             i++)
            ;
        if (aliases[i] == NULL)
            return 0; 
    }
    numbers = myldap_get_values(entry, attmap_rpc_oncRpcNumber);
    if ((numbers == NULL) || (numbers[0] == NULL))
    {
        log_log(LOG_WARNING, "%s: %s: missing", myldap_get_dn(entry),
                attmap_rpc_oncRpcNumber);
        return 0;
    }
    else if (numbers[1] != NULL)
    {
        log_log(LOG_WARNING, "%s: %s: multiple values", myldap_get_dn(entry),
                attmap_rpc_oncRpcNumber);
    }
    errno = 0;
    number = strtol(numbers[0], &tmp, 10);
    if ((*(numbers[0]) == '\0') || (*tmp != '\0'))
    {
        log_log(LOG_WARNING, "%s: %s: non-numeric", myldap_get_dn(entry),
                attmap_rpc_oncRpcNumber);
        return 0;
    }
    else if ((errno != 0) || (number > UINT32_MAX))
    {
        log_log(LOG_WARNING, "%s: %s: out of range", myldap_get_dn(entry),
                attmap_rpc_oncRpcNumber);
        return 0;
    }
    WRITE_INT32(fp, NSLCD_RESULT_BEGIN);
    WRITE_STRING(fp, name);
    WRITE_STRINGLIST_EXCEPT(fp, aliases, name);
    WRITE_INT32(fp, number);
    return 0;
}
static int write_rpc ( TFILE * fp , MYLDAP_ENTRY * entry , const char * reqname ) { int32_t tmpint32 , tmp2int32 , tmp3int32 ; const char * name ; const char * * aliases ; const char * * numbers ; char * tmp ; unsigned long number ; int i ; name = myldap_get_rdn_value ( entry , attmap_rpc_cn ) ; aliases = myldap_get_values ( entry , attmap_rpc_cn ) ; if ( ( aliases == NULL ) || ( aliases [ 0 ] == NULL ) ) { log_log ( LOG_WARNING , " " , myldap_get_dn ( entry ) , attmap_rpc_cn ) ; return 0 ; } if ( name == NULL ) name = aliases [ 0 ] ; if ( ( reqname != NULL ) && ( STR_CMP ( reqname , name ) != 0 ) ) { for ( i = 0 ; ( aliases [ i ] != NULL ) && ( STR_CMP ( reqname , aliases [ i ] ) != 0 ) ; i ++ ) ; if ( aliases [ i ] == NULL ) return 0 ; } numbers = myldap_get_values ( entry , attmap_rpc_oncRpcNumber ) ; if ( ( numbers == NULL ) || ( numbers [ 0 ] == NULL ) ) { log_log ( LOG_WARNING , " " , myldap_get_dn ( entry ) , attmap_rpc_oncRpcNumber ) ; return 0 ; } else if ( numbers [ 1 ] != NULL ) { log_log ( LOG_WARNING , " " , myldap_get_dn ( entry ) , attmap_rpc_oncRpcNumber ) ; } errno = 0 ; number = strtol ( numbers [ 0 ] , & tmp , 10 ) ; if ( ( * ( numbers [ 0 ] ) == ' \0 ' ) || ( * tmp != ' \0 ' ) ) { log_log ( LOG_WARNING , " " , myldap_get_dn ( entry ) , attmap_rpc_oncRpcNumber ) ; return 0 ; } else if ( ( errno != 0 ) || ( number > UINT32_MAX ) ) { log_log ( LOG_WARNING , " " , myldap_get_dn ( entry ) , attmap_rpc_oncRpcNumber ) ; return 0 ; } WRITE_INT32 ( fp , NSLCD_RESULT_BEGIN ) ; WRITE_STRING ( fp , name ) ; WRITE_STRINGLIST_EXCEPT ( fp , aliases , name ) ; WRITE_INT32 ( fp , number ) ; return 0 ; }
write a single rpc entry to the stream
write a single rpc entry to the stream
/* get the most canonical name */ /* get the other names for the rpc entries */ /* if the rpc name is not yet found, get the first entry */ /* check case of returned rpc entry */ /* nothing */ /* neither the name nor any of the aliases matched */ /* get the rpc number */ /* write the entry */