fmt = "%1$s%2$s%3$s%4$s%5$s%6$s%7$s%8$s%9$s%10$s%11$s";
fmt = "%1$s%2$s%3$s%4$s%5$s%6$s%7$s%8$s%9$s%10$s%11$s%12$s";
SSMSecurityAdvisorContext_GetPrefListKeywordHandler(SSMTextGenContext* cx){    SSMStatus rv = SSM_SUCCESS;    SSMSecurityAdvisorContext* adv = NULL;    PrefSet* prefs = NULL;    char* subboolfmt;    char* subfmt;    char* fmt;    PRBool boolval;    char* strval = NULL;    char* str1 = NULL;    char* str2 = NULL;    char* str3 = NULL;    char* str4 = NULL;    char* str5 = NULL;    char* str6 = NULL;    char* str7 = NULL;    char* str8 = NULL;    char* str9 = NULL;    char* str10 = NULL;    char* str11 = NULL;    if ((cx == NULL) || (cx->m_request == NULL) || (cx->m_result == NULL)) {        goto loser;    }    adv = (SSMSecurityAdvisorContext*)SSMTextGen_GetTargetObject(cx);    if ((adv == NULL) ||        !SSM_IsA((SSMResource*)adv, SSM_RESTYPE_SECADVISOR_CONTEXT)) {        goto loser;    }    /* get the prefs object */    if ((adv->super.m_connection == NULL) ||         (adv->super.m_connection->m_prefs == NULL)) {        goto loser;    }    prefs = adv->super.m_connection->m_prefs;    /* strings and formats */    subboolfmt = "var %1$s = %2$s;\n";    subfmt = "var %1$s = \"%2$s\";\n";    /* since nickname may contain ', I really should use " for quotes */    fmt = "%1$s%2$s%3$s%4$s%5$s%6$s%7$s%8$s%9$s%10$s%11$s";    /* make sure all the right default values are enforced */    rv = PREF_GetBoolPref(prefs, "security.enable_ssl2", &boolval);    if ((rv == SSM_SUCCESS) && (boolval == PR_FALSE)) {        str1 = PR_smprintf(subboolfmt, SSL2_SPK, "false");    }    else { /* default */        str1 = PR_smprintf(subboolfmt, SSL2_SPK, "true");    }    rv = PREF_GetBoolPref(prefs, "security.enable_ssl3", &boolval);    if ((rv == SSM_SUCCESS) && (boolval == PR_FALSE)) {        str2 = PR_smprintf(subboolfmt, SSL3_SPK, "false");    }    else { /* default */        str2 = PR_smprintf(subboolfmt, SSL3_SPK, "true");    }    rv = PREF_GetStringPref(prefs, "security.default_personal_cert", &strval);    if ((strval != NULL) && (PL_strcmp(strval, "Select Automatically") == 0)) {        str3 = PR_smprintf(subboolfmt, CLIENT_AUTH_SPK, "true");    }    else { /* default */        str3 = PR_smprintf(subboolfmt, CLIENT_AUTH_SPK, "false");    }    rv = PREF_GetStringPref(prefs, "security.default_mail_cert", &strval);    if (strval != NULL) {        str4 = PR_smprintf(subfmt, EMAIL_CERT_SPK, strval);    }    else {        str4 = PR_smprintf(subfmt, EMAIL_CERT_SPK, "");    }    rv = PREF_GetBoolPref(prefs, "security.warn_entering_secure", &boolval);    if ((rv == SSM_SUCCESS) && (boolval == PR_FALSE)) {        str5 = PR_smprintf(subboolfmt, WARN_ENTER_SECURE_SPK, "false");    }    else { /* default */        str5 = PR_smprintf(subboolfmt, WARN_ENTER_SECURE_SPK, "true");    }    rv = PREF_GetBoolPref(prefs, "security.warn_leaving_secure", &boolval);    if ((rv == SSM_SUCCESS) && (boolval == PR_FALSE)) {        str6 = PR_smprintf(subboolfmt, WARN_LEAVE_SECURE_SPK, "false");    }    else { /* default */        str6 = PR_smprintf(subboolfmt, WARN_LEAVE_SECURE_SPK, "true");    }    rv = PREF_GetBoolPref(prefs, "security.warn_viewing_mixed", &boolval);    if ((rv == SSM_SUCCESS) && (boolval == PR_FALSE)) {        str7 = PR_smprintf(subboolfmt, WARN_VIEW_MIXED_SPK, "false");    }    else { /* default */        str7 = PR_smprintf(subboolfmt, WARN_VIEW_MIXED_SPK, "true");    }    rv = PREF_GetBoolPref(prefs, "security.warn_submit_insecure", &boolval);    if ((rv == SSM_SUCCESS) && (boolval == PR_FALSE)) {        str8 = PR_smprintf(subboolfmt, WARN_SUBMIT_INSECURE_SPK, "false");    }    else { /* default */        str8 = PR_smprintf(subboolfmt, WARN_SUBMIT_INSECURE_SPK, "true");    }    rv = PREF_GetBoolPref(prefs, "mail.encrypt_outgoing_mail", &boolval);    if ((rv == SSM_SUCCESS) && (boolval == PR_TRUE)) {        str9 = PR_smprintf(subboolfmt, ENCRYPT_MAIL_SPK, "true");    }    else { /* default */        str9 = PR_smprintf(subboolfmt, ENCRYPT_MAIL_SPK, "false");    }    rv = PREF_GetBoolPref(prefs, "mail.crypto_sign_outgoing_mail", &boolval);    if ((rv == SSM_SUCCESS) && (boolval == PR_TRUE)) {        str10 = PR_smprintf(subboolfmt, SIGN_MAIL_SPK, "true");    }    else { /* default */        str10 = PR_smprintf(subboolfmt, SIGN_MAIL_SPK, "false");    }    rv = PREF_GetBoolPref(prefs, "mail.crypto_sign_outgoing_news", &boolval);    if ((rv == SSM_SUCCESS) && (boolval == PR_TRUE)) {        str11 = PR_smprintf(subboolfmt, SIGN_NEWS_SPK, "true");    }    else { /* default */        str11 = PR_smprintf(subboolfmt, SIGN_NEWS_SPK, "false");    }    PR_FREEIF(cx->m_result);    cx->m_result = PR_smprintf(fmt, str1, str2, str3, str4, str5, str6, str7,                               str8, str9, str10, str11);    SSM_DebugUTF8String("security advisor prefs list", cx->m_result);    goto done;loser:    if (rv == SSM_SUCCESS) {        rv = SSM_FAILURE;    }done:    PR_FREEIF(str1);    PR_FREEIF(str2);    PR_FREEIF(str3);    PR_FREEIF(str4);    PR_FREEIF(str5);    PR_FREEIF(str6);    PR_FREEIF(str7);    PR_FREEIF(str8);    PR_FREEIF(str9);    PR_FREEIF(str10);    PR_FREEIF(str11);    return SSM_SUCCESS;}