Roxen.git / server / config_interface / actions / make_rsa_csr.pike

version» Context lines:

Roxen.git/server/config_interface/actions/make_rsa_csr.pike:1:   /* -  * $Id: make_rsa_csr.pike,v 1.11 2008/08/15 12:33:54 mast Exp $ +  * $Id$    */      #if constant (Nettle)      inherit "ssl_common.pike";   inherit "wizard";   #include <roxen.h>   //<locale-token project="admin_tasks"> LOCALE </locale-token>   #define LOCALE(X,Y) _STR_LOCALE("admin_tasks",X,Y)   
Roxen.git/server/config_interface/actions/make_rsa_csr.pike:107:    "emailAddress", "challengePassword"}), attr)    {    if (id->variables[attr]) {    attrs[attr] = global.String.trim_whites(id->variables[attr]);    if (attrs[attr] == "") m_delete (attrs, attr);    }    }       array name = ({ });    if (attrs->countryName) -  name += ({(["countryName": asn1_printable_string (attrs->countryName)])}); +  name += ({([ "countryName": PrintableString(attrs->countryName) ])});    foreach( ({ "stateOrProvinceName",    "localityName", "organizationName",    "organizationUnitName", "commonName" }), attr)    {    if (attrs[attr]) -  /* UTF8String is the recommended type. But it seems that -  * netscape can't handle that. So when PrintableString doesn't -  * suffice, we use latin1 but call it TeletexString (since at -  * least netscape expects things that way). */ -  name += ({ ([ attr : (asn1_printable_valid (attrs[attr]) ? -  asn1_printable_string : -  asn1_broken_teletex_string) (attrs[attr]) ]) }); +  name += ({ ([ attr : UTF8String(attrs[attr]) ]) });    }       mapping csr_attrs = ([]);    foreach( ({ "challengePassword" }), attr)    {    if (attrs[attr]) -  csr_attrs[attr] = ({ asn1_printable_string(attrs[attr]) }); +  csr_attrs[attr] = ({ PrintableString(attrs[attr]) });    }       mapping cert_attrs = ([ ]);    foreach( ({ "emailAddress" }), attr)    {    if (attrs[attr]) -  cert_attrs[attr] = ({ asn1_IA5_string(attrs[attr]) }); +  cert_attrs[attr] = ({ IA5String(attrs[attr]) });    }       /* Not all CA:s support extendedCertificateAttributes */    if (sizeof(cert_attrs))    csr_attrs->extendedCertificateAttributes =    ({ Certificate.Attributes(Identifiers.attribute_ids,    cert_attrs) });       object csr = CSR.build_csr(rsa, -  Certificate.build_distinguished_name(@name), +  Certificate.build_distinguished_name(name),    csr_attrs);       string re;    string res=("<font size='+2'>"+    LOCALE(130,"This is your Certificate Signing Request.")+    "</font><textarea name='csr' cols='80' rows='12'>");       res += (re=Tools.PEM.simple_build_pem("CERTIFICATE REQUEST", csr->get_der()));       res += "</textarea>";
Roxen.git/server/config_interface/actions/make_rsa_csr.pike:171:   {    object privs = Privs("Storing CSR request.");    mv( id->variables->save_in_file, id->variables->save_in_file+"~" );    string fname = combine_path(getcwd(), "../local",    id->variables->save_in_file);    Stdio.File file = open(fname, "cwx", 0644);    privs = 0;    if (!file || file->write(id->variables->csr) != sizeof(id->variables->csr)) {    return http_string_answer(sprintf("<p>" +    LOCALE(155, "Failed to write CSR to %s.")+ -  "</p>\n<p><cf-cancel href='?class=&form.class;'/></p>\n", +  "</p>\n<p><cf-cancel href='?class=&form.class;&amp;&usr.set-wiz-id;'/></p>\n",    fname));    }    return http_string_answer( sprintf("<p>"+LOCALE(131,"Wrote %d bytes to %s.")+    "</p>\n<p><cf-ok/></p>\n",    strlen(id->variables->csr),    fname));   }         mixed parse( RequestID id ) { return wizard_for(id,0); }         #endif /* constant (Nettle) */