summaryrefslogtreecommitdiffstats
path: root/include/ruby/ruby.h
Commit message (Expand)AuthorAgeFilesLines
* * include/ruby/ruby.h (STR2CSTR): removed.akr2009-01-311-5/+0
* * include/ruby/ruby.h (VALUE): use unsigned long or long longnobu2009-01-161-3/+6
* * include/ruby/ruby.h (PRI_PTRDIFF_PREFIX): must define as string.usa2009-01-161-1/+1
* * configure.in (RUBY_REPLACE_TYPE): does not define rb_ prefixednobu2009-01-161-3/+26
* * ext/curses/curses.c: curses encoding should obey locale.matz2008-11-071-0/+1
* * include/ruby/ruby.h (ExportStringValue): new macro to convertmatz2008-10-201-0/+6
* * io.c (Init_IO): $FILENAME and $* must be read-only. [ruby-dev:36698]nobu2008-10-141-0/+20
* * include/ruby/ruby.h: embeds the elements of an array into itsyugui2008-10-091-8/+25
* * dln.c: Ruby no longer supports VMS.yugui2008-10-041-5/+0
* * include/ruby/ruby.h (rb_mPrecision): removed.yugui2008-09-261-1/+0
* * error.c (Init_Exception): introduce EncodingError which is amatz2008-09-261-0/+1
* * complex.c: an instance method image has been removed andtadf2008-09-201-1/+1
* * transcode.c: add "Error" suffix for Encoding exception classes.matz2008-09-181-0/+1
* * gc.c, include/ruby/ruby.h: rename rb_register_mark_object()ko12008-09-151-1/+1
* fix typos.akr2008-09-091-1/+1
* * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.matz2008-09-051-1/+1
* * gc.c, include/ruby/ruby.h: rename T_DEFERRED to T_ZOMBIE.ko12008-08-291-2/+2
* * include/ruby/ruby.h (INT2NUM): just use a simple macro on LP64.akr2008-08-211-10/+15
* fix previsous change again.akr2008-08-211-4/+6
* * include/ruby/ruby.h: fix previous change for LP64.akr2008-08-211-2/+6
* * include/ruby/ruby.h (NUM2LONG): make it inline function to evalueteakr2008-08-211-7/+44
* * include/ruby/ruby.h (rb_intern_const): tiny optimization.nobu2008-08-161-0/+6
* * include/ruby/ruby.h: commit miss.nobu2008-08-161-0/+1
* * include/ruby/ruby.h (SSIZET2NUM, NUM2SSIZET, SSIZE_MAX, SSIZE_MIN):nobu2008-08-151-0/+20
* * object.c (rb_obj_untrusted): new method Object#untrusted?.shugo2008-08-131-7/+9
* * error.c (rb_eEncCompatError): add Exception.naruse2008-08-121-0/+1
* * include/ruby/ruby.h (struct RString): size of ary must bemame2008-07-311-1/+1
* * include/ruby/ruby.h: add a type T_DEFERRED.ko12008-07-271-0/+2
* * include/ruby/ruby.h (PRI_PTRDIFF_PREFIX, PRI_SIZE_PREFIX): typo.usa2008-07-121-2/+2
* * include/ruby/ruby.h (PRI_PTRDIFF_PREFIX, PRI_SIZE_PREFIX): fixed typo.nobu2008-07-121-6/+6
* * configure.in (sizeof ptrdiff_t): check for size of ptrdiff_t.nobu2008-07-121-13/+36
* * dir.c: shoudn't use ruby object in globbing, because glob serviceusa2008-07-081-2/+2
* * dir.c: preserve encoding of strings in glob and fnmatch.naruse2008-07-071-3/+2
* * include/ruby/ruby.h (NUM2INT): cast to int.akr2008-07-051-4/+4
* * compile.h, insns.def: reduce insn operand of "trace".ko12008-07-011-12/+13
* * include/ruby/ruby.h (enum ruby_special_consts): ISO C forbidsshyouhei2008-07-011-2/+2
* * include/ruby/ruby.h (rb_intern): prefix __extnsion__ forshyouhei2008-07-011-1/+1
* * vm.c, vm_core.h,vm_core.h, vm_dump.c, iseq.c: rename class nameko12008-06-291-3/+0
* * include/ruby/ruby.h (struct RRegexp): new field usecnt. replaceakr2008-06-281-2/+5
* * include/ruby/ruby.h (rb_intern): use rb_intern2 with strlen forakr2008-06-121-1/+1
* * include/ruby/intern.h, proc.c: revert rb_proc_call() andko12008-06-101-2/+0
* * include/ruby/ruby.h (CONST_ID_CACHE): fixed statement expression.nobu2008-06-101-4/+4
* * include/ruby/ruby.h, vm_core.h: add a type rb_blockptr.mame2008-06-091-0/+2
* * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.nobu2008-06-091-6/+10
* * vm_core.h (struct rb_vm_struct): moved ruby_debug, ruby_verbose, andnobu2008-06-091-1/+4
* * suppress warnings with -Wwrite-string.nobu2008-05-311-2/+2
* * include/ruby/ruby.h: renamed include guard.nobu2008-05-311-5/+7
* * eval.c, eval_intern.h, include/ruby/intern.h, include/ruby/ruby.h,ko12008-05-221-10/+10
* * eval_intern.h, vm_core.h, include/ruby/intern.h, include/ruby/ruby.h,usa2008-05-221-10/+10
* * include/ruby/ruby.h (PRI[diouxX]VALUE): printf format for VALUE.nobu2008-05-201-0/+12
import java.io.FileReader; import java.io.IOException; import java.math.BigInteger; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import netscape.ldap.LDAPException; import netscape.security.x509.X509CertImpl; import org.apache.velocity.context.Context; import com.netscape.certsrv.apps.CMS; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.ISubsystem; import com.netscape.certsrv.ca.ICertificateAuthority; import com.netscape.certsrv.dbs.certdb.ICertificateRepository; import com.netscape.certsrv.property.PropertySet; import com.netscape.certsrv.usrgrp.IUGSubsystem; import com.netscape.certsrv.usrgrp.IUser; import com.netscape.cms.servlet.wizard.WizardServlet; import com.netscape.cmsutil.crypto.CryptoUtil; public class ImportAdminCertPanel extends WizardPanelBase { public ImportAdminCertPanel() { } /** * Initializes this panel. */ public void init(ServletConfig config, int panelno) throws ServletException { setPanelNo(panelno); setName("Import Administrator's Certificate"); } public void init(WizardServlet servlet, ServletConfig config, int panelno, String id) throws ServletException { setPanelNo(panelno); setName("Import Administrator's Certificate"); setId(id); } public boolean isSubPanel() { return true; } public void cleanUp() throws IOException { } public boolean isPanelDone() { return false; } public PropertySet getUsage() { PropertySet set = new PropertySet(); return set; } /** * Display the panel. */ public void display(HttpServletRequest request, HttpServletResponse response, Context context) { CMS.debug("ImportAdminCertPanel: display"); context.put("errorString", ""); context.put("title", "Import Administrator's Certificate"); context.put("panel", "admin/console/config/importadmincertpanel.vm"); context.put("import", "true"); IConfigStore cs = CMS.getConfigStore(); String type = ""; try { type = cs.getString("preop.ca.type", ""); } catch (Exception e) { } try { String serialno = cs.getString("preop.admincert.serialno.0"); context.put("serialNumber", serialno); } catch (Exception e) { context.put("errorString", "Failed to get serial number."); } context.put("caType", type); ISubsystem ca = CMS.getSubsystem("ca"); if (ca == null) { context.put("ca", "false"); } else { context.put("ca", "true"); } String caHost = ""; String caPort = ""; String info = ""; if (ca == null) { if (type.equals("otherca")) { try { // this is a non-CA system that has elected to have its certificates // signed by a CA outside of the security domain. // in this case, we submitted the cert request for the admin cert to // to security domain host. caHost = cs.getString("securitydomain.host", ""); caPort = cs.getString("securitydomain.httpsadminport", ""); } catch (Exception e) { } } else if (type.equals("sdca")) { try { // this is a non-CA system that submitted its certs to a CA // within the security domain. In this case, we submitted the cert // request for the admin cert to this CA caHost = cs.getString("preop.ca.hostname", ""); caPort = cs.getString("preop.ca.httpsadminport", ""); } catch (Exception e) { } } } else { // for CAs, we always generate our own admin certs // send our own connection details try { caHost = cs.getString("service.machineName", ""); caPort = cs.getString("pkicreate.admin_secure_port", ""); } catch (Exception e) { } } String pkcs7 = ""; try { pkcs7 = cs.getString("preop.admincert.pkcs7", ""); } catch (Exception e) { } context.put("pkcs7", pkcs7); context.put("caHost", caHost); context.put("caPort", caPort); context.put("info", info); } /** * Checks if the given parameters are valid. */ public void validate(HttpServletRequest request, HttpServletResponse response, Context context) throws IOException { } /** * Commit parameter changes */ public void update(HttpServletRequest request, HttpServletResponse response, Context context) throws IOException { IConfigStore cs = CMS.getConfigStore(); String type = ""; String subsystemtype = ""; String selected_hierarchy = ""; try { type = cs.getString("preop.ca.type", ""); subsystemtype = cs.getString("cs.type", ""); selected_hierarchy = cs.getString("preop.hierarchy.select", ""); } catch (Exception e) { } ICertificateAuthority ca = (ICertificateAuthority) CMS.getSubsystem( ICertificateAuthority.ID); if (ca == null) { context.put("ca", "false"); } else { context.put("ca", "true"); } context.put("caType", type); X509CertImpl certs[] = new X509CertImpl[1]; // REMINDER: This panel is NOT used by "clones" if (ca != null) { String serialno = null; if (selected_hierarchy.equals("root")) { CMS.debug("ImportAdminCertPanel update: " + "Root CA subsystem - " + "(new Security Domain)"); } else { CMS.debug("ImportAdminCertPanel update: " + "Subordinate CA subsystem - " + "(new Security Domain)"); } try { serialno = cs.getString("preop.admincert.serialno.0"); } catch (Exception e) { CMS.debug( "ImportAdminCertPanel update: Failed to get request id."); context.put("updateStatus", "failure"); throw new IOException("Failed to get request id."); } ICertificateRepository repost = ca.getCertificateRepository(); try { certs[0] = repost.getX509Certificate( new BigInteger(serialno, 16)); } catch (Exception ee) { } } else { String dir = null; // REMINDER: This panel is NOT used by "clones" if (subsystemtype.equals("CA")) { if (selected_hierarchy.equals("root")) { CMS.debug("ImportAdminCertPanel update: " + "Root CA subsystem - " + "(existing Security Domain)"); } else { CMS.debug("ImportAdminCertPanel update: " + "Subordinate CA subsystem - " + "(existing Security Domain)"); } } else { CMS.debug("ImportAdminCertPanel update: " + subsystemtype + " subsystem"); } try { dir = cs.getString("preop.admincert.b64", ""); CMS.debug("ImportAdminCertPanel update: dir=" + dir); } catch (Exception ee) { } try { BufferedReader reader = new BufferedReader( new FileReader(dir)); String b64 = ""; StringBuffer sb = new StringBuffer(); while (reader.ready()) { sb.append(reader.readLine()); } b64 = sb.toString(); reader.close(); b64 = b64.trim(); b64 = CryptoUtil.stripCertBrackets(b64); CMS.debug("ImportAdminCertPanel update: b64=" + b64); byte[] b = CryptoUtil.base64Decode(b64); certs[0] = new X509CertImpl(b); } catch (Exception e) { CMS.debug("ImportAdminCertPanel update: " + e.toString()); } } try { IUGSubsystem ug = (IUGSubsystem) CMS.getSubsystem(IUGSubsystem.ID); String uid = cs.getString("preop.admin.uid"); IUser user = ug.getUser(uid); user.setX509Certificates(certs); ug.addUserCert(user); } catch (LDAPException e) { CMS.debug("ImportAdminCertPanel update: failed to add certificate to the internal database. Exception: " + e.toString()); if (e.getLDAPResultCode() != LDAPException.ATTRIBUTE_OR_VALUE_EXISTS) { context.put("updateStatus", "failure"); throw new IOException(e.toString()); } } catch (Exception e) { CMS.debug( "ImportAdminCertPanel update: failed to add certificate. Exception: " + e.toString()); context.put("updateStatus", "failure"); throw new IOException(e.toString()); } context.put("errorString", ""); context.put("info", ""); context.put("title", "Import Administrator Certificate"); context.put("panel", "admin/console/config/importadmincertpanel.vm"); context.put("updateStatus", "success"); } public boolean shouldSkip() { try { IConfigStore c = CMS.getConfigStore(); String s = c.getString("preop.subsystem.select", null); if (s != null && s.equals("clone")) { return true; } } catch (EBaseException e) { } return false; } /** * If validiate() returns false, this method will be called. */ public void displayError(HttpServletRequest request, HttpServletResponse response, Context context) { /* This should never be called */ context.put("title", "Import Administrator Certificate"); context.put("panel", "admin/console/config/importadmincertpanel.vm"); context.put("info", ""); } }