I'm having problems with X509_NAME_free - each time I call
it, it core dumps. This happens every time on Win98 and occasionally
on Solaris. Has anyone come across a similar problem ? Any help/pointers
would be greatly appreciated. I've included the code I'm using below.

Thanks

Ray.

            if ((name = X509_get_subject_name(cert)) == NULL)
                {
                        THROW2(InvalidBaseURL, hostName, "UNKNOWN");
                }
                cout << "X509 name is [" << name << "]" << endl;

                int n = X509_NAME_entry_count(name);
                bool validUrl = false;

                for (int i = 0; i < n && !validUrl; i++)
                {
                        X509_NAME_ENTRY *ne = X509_NAME_get_entry(name,
i);

                        int nid = OBJ_obj2nid(ne->object);

                        if (nid == NID_commonName)
                        {
                                ASN1_STRING *asnstr =
X509_NAME_ENTRY_get_data(ne);

                                string certHost((const char *)
asnstr->data);

                                // Find the first '.' in each string and
point to
                                // the next character
                                //
                                int certPos = certHost.find('.') + 1;
                                int hostPos = hostName.find('.') + 1;

                                if (certHost.substr(certPos) !=
hostName.substr(hostPos))
                                {
                                        THROW2(InvalidBaseURL, hostName,
certHost);
                                }
                                else
                                {
                                        validUrl = true;
                                }
                        }

                        X509_NAME_ENTRY_free(ne);
                }

                #if !defined(HAVE_WINDOWS_H)
                cout << "X509_NAME IS [" << name << "]" << endl;
                X509_NAME_free(name);
                #endif



--

Ray O'Hagan - Orbiscom Ltd      
Phone: +353 1 2945111
http://www.orbiscom.com


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to