Hello,

snmplib/cert_util.c contains the following code:

[ ... ]

    /** add certificate type mapping */
    se_add_pair_to_slist("cert_types", strdup("pem"), NS_CERT_TYPE_PEM);
    se_add_pair_to_slist("cert_types", strdup("crt"), NS_CERT_TYPE_DER);
    se_add_pair_to_slist("cert_types", strdup("cer"), NS_CERT_TYPE_DER);
    se_add_pair_to_slist("cert_types", strdup("cert"), NS_CERT_TYPE_DER);
    se_add_pair_to_slist("cert_types", strdup("der"), NS_CERT_TYPE_DER);
    se_add_pair_to_slist("cert_types", strdup("key"), NS_CERT_TYPE_KEY);
    se_add_pair_to_slist("cert_types", strdup("private"), NS_CERT_TYPE_KEY);

[ ... ]

static int
_cert_ext_type(const char *ext)
{
    int rc = se_find_value_in_slist("cert_types", ext);
    if (SE_DNE == rc)
        return NS_CERT_TYPE_UNKNOWN;
    return rc;
}

[ ... ]

The above code seems to be based on the assumption that slists map strings
to numbers. However, se_add_pair_to_slist() works the other way around - it
maps numbers to strings. As anyone can see in se_add_pair_to_slist(), that
function returns the value SE_ALREADY_THERE whenever it is called with a
number as the third argument that had been stored previously in the same
list. So if my interpretation of that function is correct, the above seven
calls to se_add_pair_to_slist() will store only three values in the slist.
That looks like a bug to me.

Any comments ?

Bart.
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to