int X509_NAME_set(X509_NAME **xn, X509_NAME *name)
{
    if (*xn == name)
        return *xn != NULL;
    if ((name = X509_NAME_dup(name)) == NULL)
        return 0;
    X509_NAME_free(*xn);
    *xn = name;
    return 1;
}