Author: mcalmer
Date: Sat Jun 12 23:53:00 2010
New Revision: 2672
URL: http://svn.opensuse.org/viewcvs/limal?rev=2672&view=rev
Log:
blocxx::DateTime => Date
Added:
limal-branches/mc-devel/limal-ca-mgm/src/Date.cpp
limal-branches/mc-devel/limal-ca-mgm/src/String.cpp
limal-branches/mc-devel/limal-ca-mgm/src/limal/Date.hpp
limal-branches/mc-devel/limal-ca-mgm/src/limal/String.hpp
Modified:
limal-branches/mc-devel/limal-ca-mgm/src/CA.cpp
limal-branches/mc-devel/limal-ca-mgm/src/CRLData_Priv.cpp
limal-branches/mc-devel/limal-ca-mgm/src/CRLReason.cpp
limal-branches/mc-devel/limal-ca-mgm/src/CRLReason_Priv.cpp
limal-branches/mc-devel/limal-ca-mgm/src/CertificateData_Priv.cpp
limal-branches/mc-devel/limal-ca-mgm/src/CertificateIssueData.cpp
limal-branches/mc-devel/limal-ca-mgm/src/Makefile.am
limal-branches/mc-devel/limal-ca-mgm/src/OpenSSLUtils.cpp
limal-branches/mc-devel/limal-ca-mgm/src/RequestData_Priv.cpp
limal-branches/mc-devel/limal-ca-mgm/src/limal/Makefile.am
limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA1/cam.txt
limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA1/index.txt
limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA2/.rand
limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA2/crl/crl.pem
Modified: limal-branches/mc-devel/limal-ca-mgm/src/CA.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/CA.cpp?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/CA.cpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/CA.cpp Sat Jun 12 23:53:00 2010
@@ -26,7 +26,8 @@
#include
#include
#include
-#include
+#include
+#include
#include
#include
@@ -307,7 +308,7 @@
String opensslDN = requestData.getSubjectDN().getOpenSSLString();
blocxx::MD5 md5(opensslDN);
String request = md5.toString() + "-" +
- String(blocxx::DateTime::getCurrent().get());
+ String(Date::now());
path::PathInfo dKey(m_impl->repositoryDir + "/" + m_impl->caName + "/keys/"+ request + ".key");
if(dKey.exists())
@@ -555,7 +556,7 @@
blocxx::MD5 md5(name);
String requestName = md5.toString() + "-" +
- String(blocxx::DateTime::getCurrent().get());
+ String(Date::now());
path::PathInfo outPi(m_impl->repositoryDir + "/" + m_impl->caName + "/req/" + requestName + ".req");
@@ -1504,7 +1505,7 @@
LocalManagement::getCertificate(repos + "/" + caName + "/cacert.pem",
E_PEM);
- if( ca.getEndDate() > DateTime::getCurrent().get() )
+ if( ca.getEndDate() > Date::now() )
{
LOGIT_ERROR("Deleting the CA is not allowed. " <<
"The CA must be expired or no certificate was signed with this CA");
Modified: limal-branches/mc-devel/limal-ca-mgm/src/CRLData_Priv.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/CRLData_Priv.cpp?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/CRLData_Priv.cpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/CRLData_Priv.cpp Sat Jun 12 23:53:00 2010
@@ -34,7 +34,8 @@
#include
#include
#include
-#include
+#include
+#include
#include "CRLDataImpl.hpp"
#include "Utils.hpp"
@@ -74,36 +75,12 @@
memcpy(cbuf, rev->revocationDate->data, rev->revocationDate->length);
cbuf[rev->revocationDate->length] = '\0';
- String sbuf = String(cbuf);
+ std::string sbuf(cbuf);
delete [] cbuf;
-
LOGIT_DEBUG("Revocation Date: " << sbuf);
+ Date dt(sbuf, "%y%m%d%H%M%S", true);
- PerlRegEx r("^(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)Z$");
- std::vectorblocxx::String sa = convStringArray(r.capture(sbuf));
-
- if(sa.size() != 7)
- {
- LOGIT_ERROR("Can not parse date: " << sbuf);
- BLOCXX_THROW(ca_mgm::RuntimeException,
- Format(__("Cannot parse date %1."), sbuf).c_str());
- }
-
- int year = 1970;
- if(sa[1].toInt() >= 70 && sa[1].toInt() <= 99)
- {
- year = sa[1].toInt() + 1900;
- }
- else
- {
- year = sa[1].toInt() + 2000;
- }
-
- DateTime dt = DateTime(year, sa[2].toInt(), sa[3].toInt(),
- sa[4].toInt(), sa[5].toInt(), sa[6].toInt(),
- 0, DateTime::E_UTC_TIME);
-
- setRevocationDate(dt.get());
+ setRevocationDate(dt);
// get CRL Reason
@@ -326,33 +303,10 @@
memcpy(cbuf, t->data, t->length);
cbuf[t->length] = '\0';
- String sbuf = String(cbuf);
+ std::string sbuf(cbuf);
delete [] cbuf;
-
- PerlRegEx r("^(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)Z$");
- std::vectorblocxx::String sa = convStringArray(r.capture(sbuf));
-
- if(sa.size() != 7)
- {
- LOGIT_ERROR("Can not parse date: " << sbuf);
- BLOCXX_THROW(ca_mgm::RuntimeException,
- Format(__("Cannot parse date %1."), sbuf).c_str());
- }
-
- int year = 1970;
- if(sa[1].toInt() >= 70 && sa[1].toInt() <= 99)
- {
- year = sa[1].toInt() + 1900;
- }
- else
- {
- year = sa[1].toInt() + 2000;
- }
-
- DateTime dt(year, sa[2].toInt(), sa[3].toInt(),
- sa[4].toInt(), sa[5].toInt(), sa[6].toInt(),
- 0, DateTime::E_UTC_TIME);
- time_t lastUpdate = dt.get();
+ Date dt(sbuf, "%y%m%d%H%M%S", true);
+ time_t lastUpdate = dt;
// get nextUpdate
t = X509_CRL_get_nextUpdate(x509);
@@ -361,32 +315,11 @@
memcpy(cbuf, t->data, t->length);
cbuf[t->length] = '\0';
- sbuf = String(cbuf);
+ sbuf = std::string(cbuf);
delete [] cbuf;
+ dt = Date(sbuf, "%y%m%d%H%M%S", true);
- sa = convStringArray(r.capture(sbuf));
-
- if(sa.size() != 7)
- {
- LOGIT_ERROR("Can not parse date: " << sbuf);
- BLOCXX_THROW(ca_mgm::RuntimeException,
- Format(__("Cannot parse date %1."), sbuf).c_str());
- }
-
- year = 1970;
- if(sa[1].toInt() >= 70 && sa[1].toInt() <= 99)
- {
- year = sa[1].toInt() + 1900;
- }
- else
- {
- year = sa[1].toInt() + 2000;
- }
-
- dt = DateTime(year, sa[2].toInt(), sa[3].toInt(),
- sa[4].toInt(), sa[5].toInt(), sa[6].toInt(),
- 0, DateTime::E_UTC_TIME);
- time_t nextUpdate = dt.get();
+ time_t nextUpdate = dt;
setValidityPeriod(lastUpdate, nextUpdate);
@@ -400,18 +333,18 @@
i2a_ASN1_OBJECT(bio, x509->sig_alg->algorithm);
n = BIO_get_mem_data(bio, &cbuf);
- sbuf = String(cbuf, n);
+ sbuf = std::string(cbuf, n);
BIO_free(bio);
- if(sbuf.equalsIgnoreCase("sha1WithRSAEncryption") )
+ if(str::compareCI(sbuf, "sha1WithRSAEncryption") == 0 )
{
setSignatureAlgorithm(E_SHA1RSA);
}
- else if(sbuf.equalsIgnoreCase("md5WithRSAEncryption") )
+ else if(str::compareCI(sbuf, "md5WithRSAEncryption") == 0)
{
setSignatureAlgorithm(E_MD5RSA);
}
- else if(sbuf.equalsIgnoreCase("dsaWithSHA1") )
+ else if(str::compareCI(sbuf, "dsaWithSHA1") == 0 )
{
setSignatureAlgorithm(E_SHA1DSA);
}
Modified: limal-branches/mc-devel/limal-ca-mgm/src/CRLReason.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/CRLReason.cpp?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/CRLReason.cpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/CRLReason.cpp Sat Jun 12 23:53:00 2010
@@ -24,7 +24,7 @@
#include
#include
#include
-#include
+#include
#include
#include "Utils.hpp"
@@ -212,8 +212,8 @@
if(m_impl->compromiseDate != 0)
{
- DateTime dt(m_impl->compromiseDate);
- time = dt.toString("%Y%m%d%H%M%S") + "Z";
+ Date dt(m_impl->compromiseDate);
+ time = String(dt.form("%Y%m%d%H%M%SZ", true));
}
return time;
@@ -257,8 +257,8 @@
if(m_impl->compromiseDate != 0)
{
- DateTime dt(m_impl->compromiseDate);
- time = dt.toString("%Y%m%d%H%M%S") + "Z";
+ Date dt(m_impl->compromiseDate);
+ time = String(dt.form("%Y%m%d%H%M%SZ", true));
}
return time;
Modified: limal-branches/mc-devel/limal-ca-mgm/src/CRLReason_Priv.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/CRLReason_Priv.cpp?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/CRLReason_Priv.cpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/CRLReason_Priv.cpp Sat Jun 12 23:53:00 2010
@@ -30,7 +30,7 @@
#include
#include
-#include
+#include
#include "Utils.hpp"
@@ -136,15 +136,15 @@
else if(nid == NID_invalidity_date)
{
// e.g. Aug 18 15:56:46 2005 GMT
- DateTime dtime(valueString);
+ Date dtime(std::string(valueString.c_str()), "%B %d %H:%M:%S %Y %Z", true);
if(getReason().equalsIgnoreCase("keyCompromise"))
{
- setKeyCompromiseDate(dtime.get());
+ setKeyCompromiseDate(dtime);
}
else if(getReason().equalsIgnoreCase("CACompromise"))
{
- setCACompromiseDate(dtime.get());
+ setCACompromiseDate(dtime);
}
else
{
Modified: limal-branches/mc-devel/limal-ca-mgm/src/CertificateData_Priv.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/CertificateData_Priv.cpp?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/CertificateData_Priv.cpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/CertificateData_Priv.cpp Sat Jun 12 23:53:00 2010
@@ -30,7 +30,8 @@
#include
#include
-#include
+#include
+#include
#include
#include
@@ -284,34 +285,9 @@
memcpy(cbuf, t->data, t->length);
cbuf[t->length] = '\0';
- String sbuf = String(cbuf);
+ std::string sbuf = std::string(cbuf);
delete [] cbuf;
-
- PerlRegEx r("^(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)Z$");
- std::vectorblocxx::String sa = convStringArray(r.capture(sbuf));
-
- if(sa.size() != 7)
- {
- LOGIT_ERROR("Can not parse date: " << sbuf);
- BLOCXX_THROW(ca_mgm::RuntimeException,
- // %1 is an invalid date string
- Format(__("Cannot parse date %1."), sbuf).c_str());
- }
- int year = 1970;
- if(sa[1].toInt() >= 70 && sa[1].toInt() <= 99)
- {
- year = sa[1].toInt() + 1900;
- }
- else
- {
- year = sa[1].toInt() + 2000;
- }
-
- DateTime dt(year, sa[2].toInt(), sa[3].toInt(),
- sa[4].toInt(), sa[5].toInt(), sa[6].toInt(),
- 0, DateTime::E_UTC_TIME);
-
- time_t notBefore = dt.get();
+ Date notBefore(sbuf, "%y%m%d%H%M%S", true);
// get notAfter
t = X509_get_notAfter(x509);
@@ -320,32 +296,11 @@
memcpy(cbuf, t->data, t->length);
cbuf[t->length] = '\0';
- sbuf = String(cbuf);
+ sbuf = std::string(cbuf);
delete [] cbuf;
+ Date notAfter(sbuf, "%y%m%d%H%M%S", true);
- sa = convStringArray(r.capture(sbuf));
-
- if(sa.size() != 7)
- {
- LOGIT_ERROR("Can not parse date: " << sbuf);
- BLOCXX_THROW(ca_mgm::RuntimeException,
- Format(__("Cannot parse date %1."), sbuf).c_str());
- }
- year = 1970;
- if(sa[1].toInt() >= 70 && sa[1].toInt() <= 99)
- {
- year = sa[1].toInt() + 1900;
- }
- else
- {
- year = sa[1].toInt() + 2000;
- }
-
- dt = DateTime(year, sa[2].toInt(), sa[3].toInt(),
- sa[4].toInt(), sa[5].toInt(), sa[6].toInt(),
- 0, DateTime::E_UTC_TIME);
-
- setCertifyPeriode(notBefore, dt.get());
+ setCertifyPeriode(notBefore, notAfter);
// fingerprint
@@ -461,18 +416,18 @@
i2a_ASN1_OBJECT(bio, x509->cert_info->signature->algorithm);
n = BIO_get_mem_data(bio, &cbuf);
- sbuf = String(cbuf, n);
+ sbuf = std::string(cbuf, n);
BIO_free(bio);
- if(sbuf.equalsIgnoreCase("sha1WithRSAEncryption") )
+ if(str::compareCI(sbuf, "sha1WithRSAEncryption") == 0)
{
setSignatureAlgorithm( E_SHA1RSA );
}
- else if(sbuf.equalsIgnoreCase("md5WithRSAEncryption") )
+ else if(str::compareCI(sbuf, "md5WithRSAEncryption") == 0)
{
setSignatureAlgorithm( E_MD5RSA );
}
- else if(sbuf.equalsIgnoreCase("dsaWithSHA1") )
+ else if(str::compareCI(sbuf, "dsaWithSHA1") == 0)
{
setSignatureAlgorithm( E_SHA1DSA );
}
Modified: limal-branches/mc-devel/limal-ca-mgm/src/CertificateIssueData.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/CertificateIssueData.cpp?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/CertificateIssueData.cpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/CertificateIssueData.cpp Sat Jun 12 23:53:00 2010
@@ -24,7 +24,7 @@
#include
#include
#include
-#include
+#include
#include
#include "Utils.hpp"
@@ -79,12 +79,12 @@
CertificateIssueData::CertificateIssueData(CAConfig* caConfig, Type type)
: m_impl(new CertificateIssueDataImpl())
{
- m_impl->notBefore = DateTime::getCurrent().get();
+ m_impl->notBefore = Date::now();
uint32_t days = caConfig->getValue(type2Section(type, false), "default_days").toUInt32();
- DateTime dt = DateTime(getStartDate());
- dt.addDays(days);
- m_impl->notAfter = dt.get();
+ Date dt = Date(getStartDate());
+ dt += (days*24*60*60);
+ m_impl->notAfter = dt;
String md = caConfig->getValue(type2Section(type, false), "default_md");
if(md.equalsIgnoreCase("sha1"))
@@ -148,8 +148,8 @@
blocxx::String
CertificateIssueData::getStartDateAsString() const
{
- DateTime dt(getStartDate());
- String time = dt.toString("%y%m%d%H%M%S", DateTime::E_UTC_TIME) + "Z";
+ Date dt(getStartDate());
+ blocxx::String time(dt.form("%y%m%d%H%M%S", true) + "Z");
return time;
}
@@ -157,8 +157,8 @@
blocxx::String
CertificateIssueData::getEndDateAsString() const
{
- DateTime dt(getEndDate());
- String time = dt.toString("%y%m%d%H%M%S", DateTime::E_UTC_TIME) + "Z";
+ Date dt(getEndDate());
+ blocxx::String time(dt.form("%y%m%d%H%M%S", true) + "Z");
return time;
}
Added: limal-branches/mc-devel/limal-ca-mgm/src/Date.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/Date.cpp?rev=2672&view=auto
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/Date.cpp (added)
+++ limal-branches/mc-devel/limal-ca-mgm/src/Date.cpp Sat Jun 12 23:53:00 2010
@@ -0,0 +1,135 @@
+/*---------------------------------------------------------------------\
+| |
+| _ _ _ _ __ _ |
+| | | | | | \_/ | / \ | | |
+| | | | | | |_| | / /\ \ | | |
+| | |__ | | | | | | / ____ \ | |__ |
+| |____||_| |_| |_|/ / \ \|____| |
+| |
+| core library |
+| |
+| (C) SUSE Linux Products GmbH |
+\----------------------------------------------------------------------/
+
+ File: Date.cpp
+
+ Author: Michael Andres
+
+/-*/
+#include <iostream>
+
+#include
+#include
+
+#include "Utils.hpp"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace ca_mgm
+{ /////////////////////////////////////////////////////////////////
+
+ static std::string adjustLocale();
+ static void restoreLocale(const std::string & locale);
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Date::Date
+ // METHOD TYPE : Constructor
+ //
+ Date::Date( const std::string & seconds_r )
+ { str::strtonum( seconds_r, _date ); }
+
+ Date::Date( const std::string & date_str, const std::string & format, bool utc )
+ : _date(0)
+ {
+ struct tm tm = {0,0,0,0,0,0,0,0,0,0,0};
+ std::string thisLocale = adjustLocale();
+
+ char * res = ::strptime( date_str.c_str(), format.c_str(), &tm );
+ if ( res != NULL )
+ if(utc)
+ _date = ::timegm( &tm );
+ else
+ _date = ::timelocal( &tm );
+
+ restoreLocale(thisLocale);
+
+ if (res == NULL)
+ BLOCXX_THROW(ca_mgm::ValueException,
+ str::form( __("Invalid date format: '%s'"), date_str.c_str() ).c_str() );
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Date::form
+ // METHOD TYPE : std::string
+ //
+ std::string Date::form( const std::string & format_r, bool utc ) const
+ {
+ static char buf[1024];
+ std::string thisLocale = adjustLocale();
+ if ( utc )
+ {
+ if ( ! strftime( buf, 1024, format_r.c_str(), gmtime( &_date ) ) )
+ *buf = '\0';
+ } else {
+ if ( ! strftime( buf, 1024, format_r.c_str(), localtime( &_date ) ) )
+ *buf = '\0';
+ }
+ restoreLocale(thisLocale);
+
+ return buf;
+ }
+
+ static std::string adjustLocale()
+ {
+ const char * tmp = ::setlocale( LC_TIME, NULL );
+ std::string thisLocale( tmp ? tmp : "" );
+
+ if ( thisLocale.find( "UTF-8" ) == std::string::npos
+ && thisLocale.find( "utf-8" ) == std::string::npos
+ && thisLocale != "POSIX"
+ && thisLocale != "C"
+ && thisLocale != "" )
+ {
+ // language[_territory][.codeset][@modifier]
+ // add/exchange codeset with UTF-8
+ std::string needLocale = ".UTF-8";
+ std::string::size_type loc = thisLocale.find_first_of( ".@" );
+ if ( loc != std::string::npos )
+ {
+ // prepend language[_territory]
+ needLocale = thisLocale.substr( 0, loc ) + needLocale;
+ loc = thisLocale.find_last_of( "@" );
+ if ( loc != std::string::npos )
+ {
+ // append [@modifier]
+ needLocale += thisLocale.substr( loc );
+ }
+ }
+ else
+ {
+ // append ".UTF-8"
+ needLocale = thisLocale + needLocale;
+ }
+ ::setlocale( LC_TIME, needLocale.c_str() );
+ }
+ else
+ {
+ // no need to change the locale
+ thisLocale.clear();
+ }
+
+ return thisLocale;
+ }
+
+ static void restoreLocale(const std::string & locale)
+ {
+ if ( ! locale.empty() )
+ ::setlocale( LC_TIME, locale.c_str() );
+ }
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Modified: limal-branches/mc-devel/limal-ca-mgm/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/Makefile.am?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/Makefile.am (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/Makefile.am Sat Jun 12 23:53:00 2010
@@ -13,6 +13,8 @@
limallib_LTLIBRARIES = liblimal-ca-mgm.la
liblimal_ca_mgm_la_SOURCES = \
+ Date.cpp \
+ String.cpp \
ValuePosixRECheck.cpp \
ValuePerlRECheck.cpp \
ValueIntCheck.cpp \
@@ -87,5 +89,5 @@
CLEANFILES = *~
DISTCLEANFILES = Commands.hpp Utils.hpp config.log
EXTRA_DIST = *.hpp Commands.hpp.in openssl.cnf.tmpl \
- INIParser/*.h INIParser/*.hpp
+ INIParser/*.h INIParser/*.hpp
Modified: limal-branches/mc-devel/limal-ca-mgm/src/OpenSSLUtils.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/OpenSSLUtils.cpp?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/OpenSSLUtils.cpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/OpenSSLUtils.cpp Sat Jun 12 23:53:00 2010
@@ -29,7 +29,7 @@
#include
#include
#include
-#include
+#include
#include "Utils.hpp"
@@ -2104,8 +2104,8 @@
{
md5 += "-" + sa[2];
- DateTime dt( sa[2].toInt64() );
- date = dt.toString("%Y-%m-%d %H:%M:%S", DateTime::E_LOCAL_TIME);
+ Date dt( sa[2].toInt64() );
+ date = String(dt.form("%Y-%m-%d %H:%M:%S"));
}
std::map reqLine;
Modified: limal-branches/mc-devel/limal-ca-mgm/src/RequestData_Priv.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/RequestData_Priv.cpp?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/RequestData_Priv.cpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/RequestData_Priv.cpp Sat Jun 12 23:53:00 2010
@@ -30,7 +30,6 @@
#include
#include
-#include
#include
#include
#include
Added: limal-branches/mc-devel/limal-ca-mgm/src/String.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/String.cpp?rev=2672&view=auto
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/String.cpp (added)
+++ limal-branches/mc-devel/limal-ca-mgm/src/String.cpp Sat Jun 12 23:53:00 2010
@@ -0,0 +1,407 @@
+/*---------------------------------------------------------------------\
+| |
+| _ _ _ _ __ _ |
+| | | | | | \_/ | / \ | | |
+| | | | | | |_| | / /\ \ | | |
+| | |__ | | | | | | / ____ \ | |__ |
+| |____||_| |_| |_|/ / \ \|____| |
+| |
+| core library |
+| |
+| (C) SUSE Linux Products GmbH |
+\----------------------------------------------------------------------/
+
+ File: String.cpp
+
+ Author: Michael Andres
+
+/-*/
+
+#include <cstdio>
+#include <cstdarg>
+
+#include <iostream>
+
+#include "limal/String.hpp"
+
+using std::string;
+
+///////////////////////////////////////////////////////////////////
+namespace ca_mgm
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace str
+ { /////////////////////////////////////////////////////////////////
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : form
+ ** FUNCTION TYPE : std::string
+ */
+ std::string form( const char * format, ... )
+ {
+ SafeBuf safe;
+
+ va_list ap;
+ va_start( ap, format );
+ vasprintf( &safe._buf, format, ap );
+ va_end( ap );
+
+ return safe.asString();
+ }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : strerror
+ ** FUNCTION TYPE : std::string
+ */
+ std::string strerror( int errno_r )
+ {
+ return form( "(%d)%s", errno_r, ::strerror( errno_r ) );
+ }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : strToTrue
+ ** FUNCTION TYPE : bool
+ */
+ bool strToTrue( const C_Str & str )
+ {
+ std::string t( toLower( str ) );
+ return( t == "1"
+ || t == "yes"
+ || t == "true"
+ || t == "on"
+ || strtonum<long long>( str )
+ );
+ }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : strToFalse
+ ** FUNCTION TYPE : bool
+ */
+ bool strToFalse( const C_Str & str )
+ {
+ std::string t( toLower( str ) );
+ return ! ( t == "0"
+ || t == "no"
+ || t == "false"
+ || t == "off"
+ );
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ // Hexencode
+ ///////////////////////////////////////////////////////////////////
+ namespace {
+ /** What's not decoded. */
+ inline bool heIsAlNum( char ch )
+ {
+ return ( ( 'a' <= ch && ch <= 'z' )
+ ||( 'A' <= ch && ch <= 'Z' )
+ ||( '0' <= ch && ch <= '9' ) );
+ }
+ /** Hex-digit to number or -1. */
+ inline int heDecodeCh( char ch )
+ {
+ if ( '0' <= ch && ch <= '9' )
+ return( ch - '0' );
+ if ( 'A' <= ch && ch <= 'Z' )
+ return( ch - 'A' + 10 );
+ if ( 'a' <= ch && ch <= 'z' )
+ return( ch - 'A' + 10 );
+ return -1;
+ }
+ }
+
+ std::string hexencode( const C_Str & str_r )
+ {
+ static const char *const hdig = "0123456789ABCDEF";
+ std::string res;
+ res.reserve( str_r.size() );
+ for ( const char * it = str_r.c_str(); *it; ++it )
+ {
+ if ( heIsAlNum( *it ) )
+ {
+ res += *it;
+ }
+ else
+ {
+ res += '%';
+ res += hdig[(unsigned char)(*it)/16];
+ res += hdig[(unsigned char)(*it)%16];
+ }
+ }
+ return res;
+ }
+
+ std::string hexdecode( const C_Str & str_r )
+ {
+ std::string res;
+ res.reserve( str_r.size() );
+ for_( it, str_r.c_str(), str_r.c_str()+str_r.size() )
+ {
+ if ( *it == '%' )
+ {
+ int d1 = heDecodeCh( *(it+1) );
+ if ( d1 != -1 )
+ {
+ int d2 = heDecodeCh( *(it+2) );
+ if ( d2 != -1 )
+ {
+ res += (d1<<4)|d2;
+ it += 2;
+ continue;
+ }
+ }
+ }
+ // verbatim if no %XX:
+ res += *it;
+ }
+ return res;
+ }
+ ///////////////////////////////////////////////////////////////////
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : toLower
+ ** FUNCTION TYPE : std::string
+ */
+ std::string toLower( const std::string & s )
+ {
+ if ( s.empty() )
+ return s;
+
+ std::string ret( s );
+ for ( std::string::size_type i = 0; i < ret.length(); ++i )
+ {
+ if ( isupper( ret[i] ) )
+ ret[i] = static_cast<char>(tolower( ret[i] ));
+ }
+ return ret;
+ }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : toUpper
+ ** FUNCTION TYPE : std::string
+ */
+ std::string toUpper( const std::string & s )
+ {
+ if ( s.empty() )
+ return s;
+
+ std::string ret( s );
+ for ( std::string::size_type i = 0; i < ret.length(); ++i )
+ {
+ if ( islower( ret[i] ) )
+ ret[i] = static_cast<char>(toupper( ret[i] ));
+ }
+ return ret;
+ }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : trim
+ ** FUNCTION TYPE : std::string
+ */
+ std::string trim( const std::string & s, const Trim trim_r )
+ {
+ if ( s.empty() || trim_r == NO_TRIM )
+ return s;
+
+ std::string ret( s );
+
+ if ( trim_r & L_TRIM )
+ {
+ std::string::size_type p = ret.find_first_not_of( " \t\n" );
+ if ( p == std::string::npos )
+ return std::string();
+
+ ret = ret.substr( p );
+ }
+
+ if ( trim_r & R_TRIM )
+ {
+ std::string::size_type p = ret.find_last_not_of( " \t\n" );
+ if ( p == std::string::npos )
+ return std::string();
+
+ ret = ret.substr( 0, p+1 );
+ }
+
+ return ret;
+ }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : stripFirstWord
+ ** FUNCTION TYPE : std::string
+ */
+ std::string stripFirstWord( std::string & line, const bool ltrim_first )
+ {
+ if ( ltrim_first )
+ line = ltrim( line );
+
+ if ( line.empty() )
+ return line;
+
+ std::string ret;
+ std::string::size_type p = line.find_first_of( " \t" );
+
+ if ( p == std::string::npos ) {
+ // no ws on line
+ ret = line;
+ line.erase();
+ } else if ( p == 0 ) {
+ // starts with ws
+ // ret remains empty
+ line = ltrim( line );
+ }
+ else {
+ // strip word and ltim line
+ ret = line.substr( 0, p );
+ line = ltrim( line.erase( 0, p ) );
+ }
+ return ret;
+ }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : stripLastWord
+ ** FUNCTION TYPE : std::string
+ */
+ std::string stripLastWord( std::string & line, const bool rtrim_first )
+ {
+ if ( rtrim_first )
+ line = rtrim( line );
+
+ if ( line.empty() )
+ return line;
+
+ std::string ret;
+ std::string::size_type p = line.find_last_of( " \t" );
+
+ if ( p == std::string::npos ) {
+ // no ws on line
+ ret = line;
+ line.erase();
+ } else if ( p == line.size()-1 ) {
+ // ends with ws
+ // ret remains empty
+ line = rtrim( line );
+ }
+ else {
+ // strip word and rtim line
+ ret = line.substr( p+1 );
+ line = rtrim( line.erase( p ) );
+ }
+ return ret;
+ }
+
+ string gsub(const string& sData, const string& sFrom, const string& sTo)
+ {
+ string sNew;
+ sNew.reserve(sData.size());
+
+ if (! sData.empty())
+ {
+ string::size_type frLen = sFrom.length();
+ string::size_type loc = 0;
+ string::size_type oldLoc = 0;
+
+ while (string::npos != (loc = sData.find(sFrom, loc)))
+ {
+ sNew.append(sData,oldLoc,loc-oldLoc);
+ sNew.append(sTo);
+ loc += frLen;
+ oldLoc = loc;
+ if (loc >= sData.length())
+ break;
+ }
+ if (oldLoc!=sData.size())
+ sNew.append(sData,oldLoc,sData.size()-oldLoc);
+ }
+
+ return sNew;
+ }
+
+ string & replaceAll(string & str, const string & from, const string & to)
+ {
+ string::size_type pos = 0;
+ while((pos = str.find(from, pos)) != string::npos)
+ {
+ str.replace(pos, from.size(), to);
+ pos += to.size();
+
+ if (pos >= str.length())
+ break;
+ }
+ return str;
+ }
+
+
+ std::string escape( const std::string & str_r, const char sep_r )
+ {
+ std::vector<char> buf;
+ for_( s, str_r.begin(), str_r.end() )
+ {
+ switch ( *s )
+ {
+ case '"':
+ case '\'':
+ case '\\':
+ buf.push_back( '\\' );
+ buf.push_back( *s );
+ break;
+ default:
+ if ( *s == sep_r )
+ buf.push_back( '\\' );
+ buf.push_back( *s );
+ }
+ }
+ return std::string( buf.begin(), buf.end() );
+ }
+
+
+
+ /******************************************************************
+ **
+ **
+ ** FUNCTION NAME : getline
+ ** FUNCTION TYPE : std::string
+ **
+ ** DESCRIPTION :
+ */
+ static inline std::string _getline( std::istream & str, const Trim trim_r )
+ {
+ const unsigned tmpBuffLen = 1024;
+ char tmpBuff[tmpBuffLen];
+
+ std::string ret;
+ do {
+ str.clear();
+ str.getline( tmpBuff, tmpBuffLen ); // always writes '\0' terminated
+ ret += tmpBuff;
+ } while( str.rdstate() == std::ios::failbit );
+
+ return trim( ret, trim_r );
+ }
+
+ std::string getline( std::istream & str, const Trim trim_r )
+ {
+ return _getline(str, trim_r);
+ }
+
+ std::string getline( std::istream & str, bool trim )
+ {
+ return _getline(str, trim?TRIM:NO_TRIM);
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace str
+ ///////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////
+} // namespace ca_mgm
+//////////////////////////////////////////////////////////////////
Added: limal-branches/mc-devel/limal-ca-mgm/src/limal/Date.hpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/limal/Date.hpp?rev=2672&view=auto
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/limal/Date.hpp (added)
+++ limal-branches/mc-devel/limal-ca-mgm/src/limal/Date.hpp Sat Jun 12 23:53:00 2010
@@ -0,0 +1,127 @@
+/*---------------------------------------------------------------------\
+| |
+| _ _ _ _ __ _ |
+| | | | | | \_/ | / \ | | |
+| | | | | | |_| | / /\ \ | | |
+| | |__ | | | | | | / ____ \ | |__ |
+| |____||_| |_| |_|/ / \ \|____| |
+| |
+| core library |
+| |
+| (C) SUSE Linux Products GmbH |
+\----------------------------------------------------------------------/
+
+ File: Date.hpp
+
+ Author: Michael Andres
+
+/-*/
+#ifndef LIMAL_DATE_HPP
+#define LIMAL_DATE_HPP
+
+#include <ctime>
+#include <iosfwd>
+#include <string>
+
+#include "limal/Exception.hpp"
+
+///////////////////////////////////////////////////////////////////
+namespace ca_mgm
+{ /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : Date
+ //
+ /** Store and operate on date (time_t).
+ */
+ class Date
+ {
+ friend std::ostream & operator<<( std::ostream & str, const Date & obj );
+
+ public:
+
+ typedef time_t ValueType;
+
+ /** Default ctor: 0 */
+ Date()
+ : _date( 0 )
+ {}
+ /** Ctor taking time_t value. */
+ Date( ValueType date_r )
+ : _date( date_r )
+ {}
+ /** Ctor taking time_t value as string. */
+ Date( const std::string & seconds_r );
+
+ /**
+ * Ctor from a \a date_str formatted using \a format.
+ *
+ * \throws DateFormatException in case \a date_str cannot be
+ * parsed according to \a format.
+ */
+ Date( const std::string & date_str, const std::string & format, bool utc = false);
+
+ /** Return the current time. */
+ static Date now()
+ { return ::time( 0 ); }
+
+ public:
+ /** Conversion to time_t. */
+ operator ValueType() const
+ { return _date; }
+
+ /** \name Arithmetic operations.
+ * \c + \c - \c * \c / are provided via conversion to time_t.
+ */
+ //@{
+ Date & operator+=( const time_t rhs ) { _date += rhs; return *this; }
+ Date & operator-=( const time_t rhs ) { _date -= rhs; return *this; }
+ Date & operator*=( const time_t rhs ) { _date *= rhs; return *this; }
+ Date & operator/=( const time_t rhs ) { _date /= rhs; return *this; }
+
+ Date & operator++(/*prefix*/) { _date += 1; return *this; }
+ Date & operator--(/*prefix*/) { _date -= 1; return *this; }
+
+ Date operator++(int/*postfix*/) { return _date++; }
+ Date operator--(int/*postfix*/) { return _date--; }
+ //@}
+
+ public:
+ /** Return string representation according to format.
+ * \see 'man strftime' (which is used internaly) for valid
+ * conversion specifiers in format.
+ *
+ * \return An empty string on illegal format.
+ **/
+ std::string form( const std::string & format_r, bool utc = false ) const;
+
+ /** Default string representation of Date.
+ * The preferred date and time representation for the current locale.
+ **/
+ std::string asString() const
+ { return form( "%c" ); }
+
+ /** Convert to string representation of calendar time in
+ * numeric form (like "1029255142").
+ **/
+ std::string asSeconds() const
+ { return form( "%s" ); }
+
+ private:
+ /** Calendar time.
+ * The number of seconds elapsed since 00:00:00 on January 1, 1970,
+ * Coordinated Universal Time (UTC).
+ **/
+ ValueType _date;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates Date Stream output */
+ inline std::ostream & operator<<( std::ostream & str, const Date & obj )
+ { return str << obj.asString(); }
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // LIMAL_DATE_HPP
Modified: limal-branches/mc-devel/limal-ca-mgm/src/limal/Makefile.am
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/limal/Makefile.am?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/limal/Makefile.am (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/limal/Makefile.am Sat Jun 12 23:53:00 2010
@@ -20,7 +20,9 @@
ByteBuffer.hpp \
UrlUtils.hpp \
UrlBase.hpp \
- Url.hpp
+ Url.hpp \
+ Date.hpp \
+ String.hpp
CLEANFILES = *~
Added: limal-branches/mc-devel/limal-ca-mgm/src/limal/String.hpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/limal/String.hpp?rev=2672&view=auto
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/limal/String.hpp (added)
+++ limal-branches/mc-devel/limal-ca-mgm/src/limal/String.hpp Sat Jun 12 23:53:00 2010
@@ -0,0 +1,789 @@
+/*---------------------------------------------------------------------\
+| |
+| _ _ _ _ __ _ |
+| | | | | | \_/ | / \ | | |
+| | | | | | |_| | / /\ \ | | |
+| | |__ | | | | | | / ____ \ | |__ |
+| |____||_| |_| |_|/ / \ \|____| |
+| |
+| core library |
+| |
+| (C) SUSE Linux Products GmbH |
+\----------------------------------------------------------------------/
+
+ File: String.hpp
+
+ Author: Michael Andres
+
+/-*/
+#ifndef LIMAL_STRING_HPP
+#define LIMAL_STRING_HPP
+
+#include <cstring>
+
+#include <iosfwd>
+#include <vector>
+#include <string>
+
+#include
+
+//#include "zypp/base/Easy.h"
+//#include "zypp/base/PtrTypes.h"
+
+#define for_(IT,BEG,END) for ( typeof(BEG) IT = BEG, _for_end = END; IT != _for_end; ++IT )
+
+///////////////////////////////////////////////////////////////////
+namespace ca_mgm
+{ /////////////////////////////////////////////////////////////////
+
+ /** Convenience \c char* constructible from \c std::string and \c char*,
+ * it maps \c (char*)0 to an empty string.
+ *
+ * \code
+ * bool hasPrefix( const std::string & str_r, const std::string & prefix_r )
+ * { return( ::strncmp( str_r.c_str(), prefix_r.c_str(), prefix_r.size() ) == 0 ); }
+ * \endcode
+ *
+ * Called with a plain \c char* as argument, the \c std::string is created form
+ * for nothing. The implementation actually does not use the \c std::string.
+ *
+ * Best would be to implement \c hasPrefix for each combination of \c char*
+ * and \c std::string arguments:
+ *
+ * \code
+ * bool hasPrefix( const std::string & str_r, const std::string & prefix_r )
+ * { return( ::strncmp( str_r.c_str(), prefix_r.c_str(), prefix_r.size() ) == 0 ); }
+ *
+ * bool hasPrefix( const std::string & str_r, const char * prefix_r )
+ * { return( !prefix_r || ::strncmp( str_r.c_str(), prefix_r, ::strlen(prefix_r) ) == 0 ); }
+ *
+ * bool hasPrefix( const char * str_r, const std::string & prefix_r )
+ * { return( str_r ? ::strncmp( str_r, prefix_r.c_str(), prefix_r.size() ) == 0 : prefix_r.empty() ); }
+ *
+ * bool hasPrefix( const char * str_r, const char * prefix_r )
+ * { return( str && prefix_r ? ::strncmp( str_r, prefix_r, ::strlen(prefix_r) ) == 0
+ * : !((str_r && *str_r) || (prefix_r && *prefix_r)); }
+ * \endcode
+ *
+ * This is where \ref C_Str can help. Constructible from \c std::string and \c char*,
+ * it \e reduces the \c std::string to it's \c char*. At the same time it converts
+ * \c (char*)0 into an \c "" string.
+ *
+ * \code
+ * bool hasPrefix( const C_Str & str_r, const C_Str & prefix_r )
+ * { return( ::strncmp( str_r, prefix_r, prefix_r.size() ) == 0 ); }
+ * \endcode
+ */
+ class C_Str
+ {
+ public:
+ typedef std::string::size_type size_type;
+
+ public:
+ C_Str() : _val( 0 ), _sze( 0 ) {}
+ C_Str( char * c_str_r ) : _val( c_str_r ), _sze( std::string::npos ) {}
+ C_Str( const char * c_str_r ) : _val( c_str_r ), _sze( std::string::npos ) {}
+ C_Str( const std::string & str_r ) : _val( str_r.c_str() ), _sze( str_r.size() ) {}
+
+ public:
+ bool isNull() const { return !_val; }
+ bool empty() const { return !(_val && *_val); }
+ size_type size() const
+ {
+ if ( _sze == std::string::npos )
+ { _sze = _val ? ::strlen( _val ) : 0; }
+ return _sze;
+ };
+
+ operator const char *() const { return c_str(); }
+ const char * c_str() const { return _val ? _val : ""; }
+
+ private:
+ const char *const _val;
+ mutable size_type _sze;
+ };
+
+ /** \relates C_Str Stream output */
+ inline std::ostream & operator<<( std::ostream & str, const C_Str & obj )
+ { return str << obj.c_str(); }
+
+ ///////////////////////////////////////////////////////////////////
+ /** String related utilities and \ref ZYPP_STR_REGEX.
+ \see \ref ZYPP_STR_REGEX
+ */
+ namespace str
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ /**
+ * Global asString() that works with std::string too
+ */
+ template<class _T>
+ inline std::string asString( const _T &t )
+ { return t.asString(); }
+
+ /*
+ template<class _T>
+ inline std::string asString( const intrusive_ptr<_T> &p )
+ { return p->asString(); }
+
+ template<class _T>
+ inline std::string asString( const weak_ptr<_T> &p )
+ { return p->asString(); }
+ */
+ template<>
+ inline std::string asString( const std::string &t )
+ { return t; }
+
+ ///////////////////////////////////////////////////////////////////
+ /** Printf style construction of std::string. */
+ std::string form( const char * format, ... )
+ __attribute__ ((format (printf, 1, 2)));
+
+ ///////////////////////////////////////////////////////////////////
+ /** Return string describing the \a error_r code.
+ * Like ::strerror, but the numerical value is included in
+ * the string as well.
+ */
+ std::string strerror( int errno_r );
+
+ ///////////////////////////////////////////////////////////////////
+ /** Assert \c free called for allocated <tt>char *</tt>.
+ * \code
+ * ...
+ * SafeBuf safe;
+ * vasprintf( &safe._buf, format, ap );
+ * return safe.asString();
+ * \endcode
+ *
+ * \ingroup g_RAII
+ */
+ struct SafeBuf
+ {
+ char * _buf;
+ SafeBuf() : _buf( 0 ) {}
+ ~SafeBuf() { if ( _buf ) free( _buf ); }
+ std::string asString() const
+ { return _buf ? std::string(_buf) : std::string(); }
+ };
+
+ ///////////////////////////////////////////////////////////////////
+ /** \name String representation of number.
+ *
+ * Optional second argument sets the minimal string width (' ' padded).
+ * Negative values will cause the number to be left adjusted within the string.
+ *
+ * Default width is 0.
+ * \code
+ * numstring(42) -> "42"
+ * numstring(42, 4) -> " 42"
+ * numstring(42,-4) -> "42 "
+ * \endcode
+ **/
+ //@{
+ inline std::string numstring( char n, int w = 0 ) { return form( "%*hhd", w, n ); }
+ inline std::string numstring( unsigned char n, int w = 0 ) { return form( "%*hhu", w, n ); }
+ inline std::string numstring( short n, int w = 0 ) { return form( "%*hd", w, n ); }
+ inline std::string numstring( unsigned short n, int w = 0 ) { return form( "%*hu", w, n ); }
+ inline std::string numstring( int n, int w = 0 ) { return form( "%*d", w, n ); }
+ inline std::string numstring( unsigned n, int w = 0 ) { return form( "%*u", w, n ); }
+ inline std::string numstring( long n, int w = 0 ) { return form( "%*ld", w, n ); }
+ inline std::string numstring( unsigned long n, int w = 0 ) { return form( "%*lu", w, n ); }
+ inline std::string numstring( long long n, int w = 0 ) { return form( "%*lld", w, n ); }
+ inline std::string numstring( unsigned long long n, int w = 0 ) { return form( "%*llu", w, n ); }
+ //@}
+
+ ///////////////////////////////////////////////////////////////////
+ /** \name String representation of number as hex value with leading '0x'.
+ * Optional second argument sets the minimal
+ * string width (0 padded). Negative values will cause the number to be left adjusted
+ * within the string. Default width is 10 (4 for char).
+ * <PRE>
+ * hexstring(42) -> "0x0000002a"
+ * hexstring(42, 4) -> "0x2a"
+ * hexstring(42,-4) -> "0x2a"
+ * </PRE>
+ **/
+ //@{
+ inline std::string hexstring( char n, int w = 4 ) { return form( "%#0*hhx", w, n ); }
+ inline std::string hexstring( unsigned char n, int w = 4 ) { return form( "%#0*hhx", w, n ); }
+ inline std::string hexstring( short n, int w = 10 ){ return form( "%#0*hx", w, n ); }
+ inline std::string hexstring( unsigned short n, int w = 10 ){ return form( "%#0*hx", w, n ); }
+ inline std::string hexstring( int n, int w = 10 ){ return form( "%#0*x", w, n ); }
+ inline std::string hexstring( unsigned n, int w = 10 ){ return form( "%#0*x", w, n ); }
+ inline std::string hexstring( long n, int w = 10 ){ return form( "%#0*lx", w, n ); }
+ inline std::string hexstring( unsigned long n, int w = 10 ){ return form( "%#0*lx", w, n ); }
+ inline std::string hexstring( long long n, int w = 0 ) { return form( "%#0*llx", w, n ); }
+ inline std::string hexstring( unsigned long long n, int w = 0 ) { return form( "%#0*llx", w, n ); }
+ //@}
+
+ ///////////////////////////////////////////////////////////////////
+ /** \name String representation of number as octal value with leading '0'.
+ * Optional second argument sets the minimal
+ * string width (0 padded). Negative values will cause the number to be left adjusted
+ * within the string. Default width is 5 (4 for char).
+ * <PRE>
+ * octstring(42) -> "00052"
+ * octstring(42, 4) -> "0052"
+ * octstring(42,-4) -> "052 "
+ * </PRE>
+ **/
+ //@{
+ inline std::string octstring( char n, int w = 4 ) { return form( "%#0*hho", w, n ); }
+ inline std::string octstring( unsigned char n, int w = 4 ) { return form( "%#0*hho", w, n ); }
+ inline std::string octstring( short n, int w = 5 ) { return form( "%#0*ho", w, n ); }
+ inline std::string octstring( unsigned short n, int w = 5 ) { return form( "%#0*ho", w, n ); }
+ inline std::string octstring( int n, int w = 5 ) { return form( "%#0*o", w, n ); }
+ inline std::string octstring( unsigned n, int w = 5 ) { return form( "%#0*o", w, n ); }
+ inline std::string octstring( long n, int w = 5 ) { return form( "%#0*lo", w, n ); }
+ inline std::string octstring( unsigned long n, int w = 5 ) { return form( "%#0*lo", w, n ); }
+ inline std::string octstring( long long n, int w = 0 ) { return form( "%#0*llo", w, n ); }
+ inline std::string octstring( unsigned long long n, int w = 0 ) { return form( "%#0*llo", w, n ); }
+ //@}
+
+ ///////////////////////////////////////////////////////////////////
+ /** Parsing numbers from string.
+ */
+ //@{
+ /** String to integer type determined by template arg.
+ * \note Only specializations are defined.
+ * \code
+ * time_t t = strtonum( "42" );
+ * \endcode
+ */
+ template<typename _It>
+ _It strtonum( const C_Str & str );
+
+ template<>
+ inline short strtonum( const C_Str & str ) { return ::strtol ( str, NULL, 0 ); }
+ template<>
+ inline int strtonum( const C_Str & str ) { return ::strtol ( str, NULL, 0 ); }
+ template<>
+ inline long strtonum( const C_Str & str ) { return ::strtol ( str, NULL, 0 ); }
+ template<>
+ inline long long strtonum( const C_Str & str ) { return ::strtoll ( str, NULL, 0 ); }
+
+ template<>
+ inline unsigned short strtonum( const C_Str & str ) { return ::strtoul ( str, NULL, 0 ); }
+ template<>
+ inline unsigned strtonum( const C_Str & str ) { return ::strtoul ( str, NULL, 0 ); }
+ template<>
+ inline unsigned long strtonum( const C_Str & str ) { return ::strtoul ( str, NULL, 0 ); }
+ template<>
+ inline unsigned long long strtonum( const C_Str & str ) { return ::strtoull( str, NULL, 0 ); }
+
+ /** String to integer type detemined 2nd function arg \a i.
+ * \code
+ * time_t t; strtonum( "42", t );
+ * \endcode
+ */
+ template<typename _It>
+ inline _It strtonum( const C_Str & str, _It & i )
+ { return i = strtonum<_It>( str ); }
+ //@}
+
+ ///////////////////////////////////////////////////////////////////
+ /** Parsing boolean from string.
+ */
+ //@{
+ /** Return \c true if str is <tt>1, true, yes, on</tt> (or a nonzero number). */
+ bool strToTrue( const C_Str & str );
+
+ /** Return \c false if str is <tt>0, false, no, off</tt>. */
+ bool strToFalse( const C_Str & str );
+
+ /** Parse \c str into a bool depending on the default value.
+ * If the \c default is true, look for a legal \c false string.
+ * If the \c default is false, look for a legal \c true string.
+ */
+ inline bool strToBool( const C_Str & str, bool default_r )
+ { return( default_r ? strToFalse( str ) : strToTrue( str ) ); }
+
+ /** Parse \c str into a bool if it's a legal \c true or \c false string.
+ * If \c str is not a recognized \c true or \c false string, \a return_r
+ * is left unchanged.
+ */
+ inline bool strToBoolNodefault( const C_Str & str, bool & return_r )
+ {
+ if ( strToTrue( str ) ) return (return_r = true);
+ if ( !strToFalse( str ) ) return (return_r = false);
+ return return_r;
+ }
+
+ //@}
+
+ /**
+ * \short Looks for text in a string and replaces it.
+ *
+ * \note It only perform substtution in one pass
+ */
+ std::string gsub( const std::string& sData, const std::string& sFrom, const std::string& sTo);
+
+ /**
+ * \short Looks for text in string and replaces it in place
+ *
+ *
+ * \note It only perform substtution in one pass
+ * \note use only if you replace same lenght strings, otherwise use gsub
+ */
+ std::string& replaceAll( std::string & str, const std::string & from, const std::string & to);
+
+ ///////////////////////////////////////////////////////////////////
+ /** \name Split. */
+ //@{
+ /** Split \a line_r into words.
+ * Any sequence of characters in \a sepchars_r is treated as
+ * delimiter. The words are passed to OutputIterator \a result_r.
+ * \code
+ * std::vectorstd::string words;
+ * str::split( "some line", std::back_inserter(words) )
+ * \endcode
+ *
+ */
+ template<class _OutputIterator>
+ unsigned split( const C_Str & line_r,
+ _OutputIterator result_r,
+ const C_Str & sepchars_r = " \t" )
+ {
+ const char * beg = line_r;
+ const char * cur = beg;
+ // skip leading sepchars
+ while ( *cur && ::strchr( sepchars_r, *cur ) )
+ ++cur;
+ unsigned ret = 0;
+ for ( beg = cur; *beg; beg = cur, ++result_r, ++ret )
+ {
+ // skip non sepchars
+ while( *cur && !::strchr( sepchars_r, *cur ) )
+ ++cur;
+ // build string
+ *result_r = std::string( beg, cur-beg );
+ // skip sepchars
+ while ( *cur && ::strchr( sepchars_r, *cur ) )
+ ++cur;
+ }
+ return ret;
+ }
+
+ /** Split \a line_r into words with respect to escape delimeters.
+ * Any sequence of characters in \a sepchars_r is treated as
+ * delimiter if not inside "" or "" or escaped by \, but not \\.
+ * The words are passed to OutputIterator \a result_r.
+ *
+ * \see \ref splitEscaped
+ *
+ * \code
+ * std::vectorstd::string words;
+ * str::splitEscaped( "some line", std::back_inserter(words) )
+ * \endcode
+ *
+ * \code
+ * example splitted strings
+ * normal line -> 2 elements ( "normal", "line" )
+ * escaped\ line -> 1 element( "escaped line" )
+ * "quoted line" -> 1 element same as above
+ * 'quoted line' -> 1 element same as above
+ * "escaped quote\'" -> 1 element ( "escaped quote'" )
+ *
+ * \param line_r The string to parse.
+ * \param result_r
+ * \param sepchars_r String of separator characters.
+ * \param withEmpty Whether to include empty fields between separators in the result.
+ *
+ * \endcode
+ */
+ template<class _OutputIterator>
+ unsigned splitEscaped( const C_Str & line_r,
+ _OutputIterator result_r,
+ const C_Str & sepchars_r = " \t",
+ bool withEmpty = false)
+ {
+ const char * beg = line_r;
+ const char * cur = beg;
+ unsigned ret = 0;
+
+ // skip leading sepchars
+ while ( *cur && ::strchr( sepchars_r, *cur ) )
+ {
+ ++cur;
+ if (withEmpty)
+ {
+ *result_r = "";
+ ++ret;
+ }
+ }
+
+ // there were only sepchars in the string
+ if (!*cur && withEmpty)
+ {
+ *result_r = "";
+ return ++ret;
+ }
+
+ // after the leading sepchars
+ for ( beg = cur; *beg; beg = cur, ++result_r, ++ret )
+ {
+ if ( *cur == '"' || *cur == '\'' )
+ {
+ char closeChar = *cur;
+ ++cur;
+ bool cont = true;
+ while (cont)
+ {
+ while ( *cur && *cur != closeChar)
+ ++cur;
+ if ( *cur == '\0' )
+ {
+ return ret; //TODO parsing exception no closing quote
+ }
+ int escCount = 0;
+ const char * esc = cur-1;
+ while ( esc != beg && *esc == '\\' )
+ {
+ escCount++;
+ --esc;
+ }
+ cont = (escCount % 2 == 1); // find some non escaped escape char
+ cur++; //skip quote
+ }
+
+ std::string s( beg+1, cur-beg-2 ); //without quotes
+ //transform escaped escape
+ replaceAll( s, "\\\\", "\\" );
+ //transform escaped quotes (only same as open
+ char tmpn[2] = { closeChar, 0 };
+ char tmpo[3] = { '\\', closeChar, 0 };
+ replaceAll( s, tmpo, tmpn );
+
+ *result_r = s;
+ }
+ else
+ {
+ // skip non sepchars
+ while( *cur && !::strchr( sepchars_r, *cur ) )
+ {
+ //ignore char after backslash
+ if ( *cur == '\\' )
+ {
+ ++cur;
+ }
+ ++cur;
+ }
+ // build string
+ std::string s( beg, cur-beg );
+ //transform escaped escape
+ replaceAll( s, "\\\\", "\\" );
+
+ const char *delimeter = sepchars_r;
+ while ( *delimeter )
+ {
+ std::string ds("\\");
+ const char tmp[2] = { *delimeter, '\0' };
+ std::string del(tmp);
+ ds+= del;
+ replaceAll( s, ds, del );
+ ++delimeter;
+ }
+
+ *result_r = s;
+ }
+ // skip sepchars
+ if ( *cur && ::strchr( sepchars_r, *cur ) )
+ ++cur;
+ while ( *cur && ::strchr( sepchars_r, *cur ) )
+ {
+ ++cur;
+ if (withEmpty)
+ {
+ *result_r = "";
+ ++ret;
+ }
+ }
+ // the last was a separator => one more field
+ if ( !*cur && withEmpty && ::strchr( sepchars_r, *(cur-1) ) )
+ {
+ *result_r = "";
+ ++ret;
+ }
+ }
+ return ret;
+ }
+
+ /** Split \a line_r into fields.
+ * Any single character in \a sepchars_r is treated as a
+ * field separator. The words are passed to OutputIterator
+ * \a result_r.
+ * \code
+ * "" -> words 0
+ * ":" -> words 2 |||
+ * "a" -> words 1 |a|
+ * ":a" -> words 2 ||a|
+ * "a:" -> words 2 |a||
+ * ":a:" -> words 3 ||a||
+ *
+ * \endcode
+ *
+ * \code
+ * std::vectorstd::string words;
+ * str::split( "some line", std::back_inserter(words) )
+ * \endcode
+ *
+ */
+ template<class _OutputIterator>
+ unsigned splitFields( const C_Str & line_r,
+ _OutputIterator result_r,
+ const C_Str & sepchars_r = ":" )
+ {
+ const char * beg = line_r;
+ const char * cur = beg;
+ unsigned ret = 0;
+ for ( beg = cur; *beg; beg = cur, ++result_r )
+ {
+ // skip non sepchars
+ while( *cur && !::strchr( sepchars_r, *cur ) )
+ ++cur;
+ // build string
+ *result_r = std::string( beg, cur-beg );
+ ++ret;
+ // skip sepchar
+ if ( *cur )
+ {
+ ++cur;
+ if ( ! *cur ) // ending with sepchar
+ {
+ *result_r = std::string(); // add final empty field
+ ++ret;
+ break;
+ }
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * Split \a line_r into fields handling also escaped separators.
+ *
+ * \see splitFields()
+ * \see splitEscaped()
+ */
+ template<class _OutputIterator>
+ unsigned splitFieldsEscaped( const C_Str & line_r,
+ _OutputIterator result_r,
+ const C_Str & sepchars_r = ":" )
+ {
+ return
+ splitEscaped( line_r, result_r, sepchars_r, true /* withEmpty */ );
+ }
+
+ //@}
+
+ ///////////////////////////////////////////////////////////////////
+ /** \name Join. */
+ //@{
+ /** Join strings using separator \a sep_r (defaults to BLANK). */
+ template <class _Iterator>
+ std::string join( _Iterator begin, _Iterator end,
+ const C_Str & sep_r = " " )
+ {
+ std::string res;
+ for ( _Iterator iter = begin; iter != end; ++ iter )
+ {
+ if ( iter != begin )
+ res += sep_r;
+ res += asString(*iter);
+ }
+ return res;
+ }
+
+ /** Join strings using separator \a sep_r (defaults to BLANK). */
+ template <class _Container>
+ std::string join( const _Container & cont_r,
+ const C_Str & sep_r = " " )
+ { return join( cont_r.begin(), cont_r.end(), sep_r ); }
+
+ /** Join strings using separator \a sep_r, quoting or escaping the values.
+ * Separator defaults to BLANK. Use \ref splitEscaped to restore the
+ * values.
+ */
+ template <class _Iterator>
+ std::string joinEscaped( _Iterator begin, _Iterator end,
+ const char sep_r = ' ' )
+ {
+ std::vector<char> buf;
+ for ( _Iterator iter = begin; iter != end; ++ iter )
+ {
+ if ( iter != begin )
+ buf.push_back( sep_r );
+
+ if ( iter->empty() )
+ {
+ // empty string goes ""
+ buf.push_back( '"' );
+ buf.push_back( '"' );
+ }
+ else
+ {
+ std::string toadd( asString(*iter) );
+ for_( ch, toadd.begin(), toadd.end() )
+ {
+ switch ( *ch )
+ {
+ case '"':
+ case '\'':
+ case '\\':
+ buf.push_back( '\\' );
+ buf.push_back( *ch );
+ break;
+ default:
+ if ( *ch == sep_r )
+ buf.push_back( '\\' );
+ buf.push_back( *ch );
+ }
+ }
+ }
+ }
+ return std::string( buf.begin(), buf.end() );
+ }
+
+
+ /**
+ * Escape desired character \a c using a backslash.
+ *
+ * For use when printing \a c separated values, and where
+ * \ref joinEscaped() is too heavy.
+ *
+ * \todo use C_Str instead of std::string to prevent unnecessary
+ * promotion to string if used with "string".
+ *
+ * \todo shoud not be documented in doxy-group 'Join'
+ */
+ std::string escape(const std::string & str_r, const char c = ' ' );
+
+ //! \todo unsecape()
+
+ //@}
+ ///////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ /** \name Hexencode.
+ * Encode all characters other than [a-zA-Z0-9] as %XX.
+ * This includes the % character itself, which becomes %25.
+ */
+ //@{
+ /** Encode all characters other than [a-zA-Z0-9] as %XX.
+ * This includes the % character itself, which becomes %25.
+ */
+ std::string hexencode( const C_Str & str_r );
+ /** Decode hexencoded %XX sequences. */
+ std::string hexdecode( const C_Str & str_r );
+ //@}
+ ///////////////////////////////////////////////////////////////////
+
+ /** \name Case conversion. */
+ //@{
+ /** Return lowercase version of \a s
+ * \todo improve
+ */
+ std::string toLower( const std::string & s );
+ /** \overload */
+ inline std::string toLower( const char * s )
+ { return( s ? toLower( std::string(s) ) : std::string() ); }
+
+ /** Return uppercase version of \a s
+ * \todo improve
+ */
+ std::string toUpper( const std::string & s );
+ /** \overload */
+ inline std::string toUpper( const char * s )
+ { return( s ? toUpper( std::string(s) ) : std::string() ); }
+ //@}
+
+
+ /** \name Case insensitive comparison. */
+ //@{
+ inline int compareCI( const C_Str & lhs, const C_Str & rhs )
+ {
+ if ( lhs == rhs )
+ return 0;
+ return ::strcasecmp( lhs, rhs );
+ }
+ //@}
+
+ /** \name Locate substring. */
+ //@{
+ /** Locate substring case sensitive. */
+ inline bool contains( const C_Str & str_r, const C_Str & val_r )
+ { return ::strstr( str_r, val_r ); }
+ /** Locate substring case insensitive. */
+ inline bool containsCI( const C_Str & str_r, const C_Str & val_r )
+ { return ::strcasestr( str_r, val_r ); }
+ //@}
+
+ ///////////////////////////////////////////////////////////////////
+ /** \name Trimming whitepace.
+ * \todo optimize l/r trim.
+ */
+ //@{
+ /** To define how to trim. */
+ enum Trim {
+ NO_TRIM = 0x00,
+ L_TRIM = 0x01,
+ R_TRIM = 0x02,
+ TRIM = (L_TRIM|R_TRIM)
+ };
+
+ std::string trim( const std::string & s, const Trim trim_r = TRIM );
+
+ inline std::string ltrim( const std::string & s )
+ { return trim( s, L_TRIM ); }
+
+ inline std::string rtrim( const std::string & s )
+ { return trim( s, R_TRIM ); }
+ //@}
+
+ std::string stripFirstWord( std::string & line, const bool ltrim_first );
+
+ std::string stripLastWord( std::string & line, const bool rtrim_first );
+
+ std::string getline( std::istream & str, bool trim = false );
+
+ std::string getline( std::istream & str, const Trim trim_r );
+
+ ///////////////////////////////////////////////////////////////////
+
+ /** \name String prefix/suffix handling.
+ */
+ //@{
+ /** Return whether \a str_r has prefix \a prefix_r. */
+ inline bool hasPrefix( const C_Str & str_r, const C_Str & prefix_r )
+ { return( ::strncmp( str_r, prefix_r, prefix_r.size() ) == 0 ); }
+
+ /** Strip a \a prefix_r from \a str_r and return the resulting string. */
+ inline std::string stripPrefix( const C_Str & str_r, const C_Str & prefix_r )
+ { return( hasPrefix( str_r, prefix_r ) ? str_r + prefix_r.size() : str_r.c_str() ); }
+
+ /** Return whether \a str_r has suffix \a suffix_r. */
+ inline bool hasSuffix( const C_Str & str_r, const C_Str & suffix_r )
+ { return( str_r.size() >= suffix_r.size() && ::strncmp( str_r + str_r.size() - suffix_r.size() , suffix_r, suffix_r.size() ) == 0 ); }
+
+ /** Strip a \a suffix_r from \a str_r and return the resulting string. */
+ inline std::string stripSuffix( const C_Str & str_r, const C_Str & suffix_r )
+ {
+ if ( hasSuffix( str_r, suffix_r ) )
+ return std::string( str_r, str_r.size() - suffix_r.size() );
+ return str_r.c_str();
+ }
+
+ /** alias for \ref hasPrefix */
+ inline bool startsWith( const C_Str & str_r, const C_Str & prefix_r )
+ { return hasPrefix( str_r, prefix_r ); }
+ /** alias for \ref hasSuffix */
+ inline bool endsWith( const C_Str & str_r, const C_Str & prefix_r )
+ { return hasSuffix( str_r, prefix_r ); }
+ //@}
+ /////////////////////////////////////////////////////////////////
+ } // namespace str
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace ca_mgm
+///////////////////////////////////////////////////////////////////
+#endif // LIMAL_STRING_HPP
Modified: limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA1/cam.txt
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA1/cam.txt?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA1/cam.txt (original)
+++ limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA1/cam.txt Sat Jun 12 23:53:00 2010
@@ -1,14 +1,14 @@
-b4d4e48e6de644c953290eb2854a6ced-1276349522 /C=DE/CN=Test CA\/SUSE Inc.\\Gmbh/emailAddress=suse@suse.de
-bc5324c7f5c2a27492fb6795745b596b-1276349524 /C=DE/CN=Test Server Certificate\/SUSE Inc.\\Gmbh/emailAddress=suse@suse.de
-40717a16174dc4d516f6fa7ee8eeb18c-1276349528 /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
-40717a16174dc4d516f6fa7ee8eeb18c-1276349531 /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
-40717a16174dc4d516f6fa7ee8eeb18c-1276349534 /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
-b4d4e48e6de644c953290eb2854a6ced-1276349542 /C=DE/CN=Test CA\/SUSE Inc.\\Gmbh/emailAddress=suse@suse.de
-c293624b6a877f401407ce8f8f1f327e-1276349543 /C=DE/L=Nuremberg/O=SUSE Linux GmbH/OU=IT/CN=SUSE User CA/emailAddress=security-team@suse.de
-b4d4e48e6de644c953290eb2854a6ced-1276349545 /C=DE/CN=Test CA\/SUSE Inc.\\Gmbh/emailAddress=suse@suse.de
-c1943ae4b9bd7320fae3e29f217483e3-1276349546 /C=DE/CN=Test Request/emailAddress=suse@suse.de
-d816690a832b0e52becd255d3a62e975-1276349550 /C=DE/CN=Test Certificate for revocation 2/emailAddress=suse@suse.de
-9198f6798d9da70d7cbfb67b610633f5-1276349554 /C=DE/CN=Test Certificate for revocation 3/emailAddress=suse@suse.de
-3e248858337c2b46dc67a0f9389376dd-1276349556 /C=DE/CN=Test Certificate for revocation 4/emailAddress=suse@suse.de
-bf04fdd95062554800c1556085f47063-1276349559 /C=DE/CN=Test Certificate for revocation 5 oid test/emailAddress=suse@suse.de
-9797ac11af29f94b82c1e5b0499ab5f2-1276349560 /C=DE/CN=Test Sub CA/emailAddress=suse@suse.de
+b4d4e48e6de644c953290eb2854a6ced-1276379457 /C=DE/CN=Test CA\/SUSE Inc.\\Gmbh/emailAddress=suse@suse.de
+bc5324c7f5c2a27492fb6795745b596b-1276379459 /C=DE/CN=Test Server Certificate\/SUSE Inc.\\Gmbh/emailAddress=suse@suse.de
+40717a16174dc4d516f6fa7ee8eeb18c-1276379465 /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
+40717a16174dc4d516f6fa7ee8eeb18c-1276379469 /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
+40717a16174dc4d516f6fa7ee8eeb18c-1276379472 /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
+b4d4e48e6de644c953290eb2854a6ced-1276379481 /C=DE/CN=Test CA\/SUSE Inc.\\Gmbh/emailAddress=suse@suse.de
+c293624b6a877f401407ce8f8f1f327e-1276379482 /C=DE/L=Nuremberg/O=SUSE Linux GmbH/OU=IT/CN=SUSE User CA/emailAddress=security-team@suse.de
+b4d4e48e6de644c953290eb2854a6ced-1276379484 /C=DE/CN=Test CA\/SUSE Inc.\\Gmbh/emailAddress=suse@suse.de
+c1943ae4b9bd7320fae3e29f217483e3-1276379485 /C=DE/CN=Test Request/emailAddress=suse@suse.de
+d816690a832b0e52becd255d3a62e975-1276379486 /C=DE/CN=Test Certificate for revocation 2/emailAddress=suse@suse.de
+9198f6798d9da70d7cbfb67b610633f5-1276379491 /C=DE/CN=Test Certificate for revocation 3/emailAddress=suse@suse.de
+3e248858337c2b46dc67a0f9389376dd-1276379492 /C=DE/CN=Test Certificate for revocation 4/emailAddress=suse@suse.de
+bf04fdd95062554800c1556085f47063-1276379493 /C=DE/CN=Test Certificate for revocation 5 oid test/emailAddress=suse@suse.de
+9797ac11af29f94b82c1e5b0499ab5f2-1276379496 /C=DE/CN=Test Sub CA/emailAddress=suse@suse.de
Modified: limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA1/index.txt
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA1/index.txt?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA1/index.txt (original)
+++ limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA1/index.txt Sat Jun 12 23:53:00 2010
@@ -1,11 +1,11 @@
-V 110612133204Z 01 unknown /C=DE/CN=Test CA/SUSE Inc.\Gmbh/emailAddress=suse@suse.de
-V 110612133204Z 02 unknown /C=DE/CN=Test Server Certificate/SUSE Inc.\Gmbh/emailAddress=suse@suse.de
-V 110612133206Z 03 unknown /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
-V 110612133209Z 04 unknown /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
-V 110612133212Z 05 unknown /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
-R 110612133228Z 100612133230Z 06 unknown /C=DE/CN=Test Certificate for revocation/emailAddress=suse@suse.de
-R 110612133230Z 100612133233Z,holdInstruction,holdInstructionCallIssuer 07 unknown /C=DE/CN=Test Certificate for revocation 2/emailAddress=suse@suse.de
-R 110612133234Z 100612133236Z,keyTime,20100612151556Z 08 unknown /C=DE/CN=Test Certificate for revocation 3/emailAddress=suse@suse.de
-R 110612133236Z 100612133238Z,CAkeyTime,20100612151558Z 09 unknown /C=DE/CN=Test Certificate for revocation 4/emailAddress=suse@suse.de
-R 110612133238Z 100612133239Z,holdInstruction,1.6.21.43 0A unknown /C=DE/CN=Test Certificate for revocation 5 oid test/emailAddress=suse@suse.de
-V 120611133240Z 0B unknown /C=DE/CN=Test Sub CA/emailAddress=suse@suse.de
+V 110612215059Z 01 unknown /C=DE/CN=Test CA/SUSE Inc.\Gmbh/emailAddress=suse@suse.de
+V 110612215059Z 02 unknown /C=DE/CN=Test Server Certificate/SUSE Inc.\Gmbh/emailAddress=suse@suse.de
+V 110612215103Z 03 unknown /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
+V 110612215106Z 04 unknown /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
+V 110612215110Z 05 unknown /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
+R 110612215125Z 100612215126Z 06 unknown /C=DE/CN=Test Certificate for revocation/emailAddress=suse@suse.de
+R 110612215126Z 100612215130Z,holdInstruction,holdInstructionCallIssuer 07 unknown /C=DE/CN=Test Certificate for revocation 2/emailAddress=suse@suse.de
+R 110612215131Z 100612215131Z,keyTime,20100612213451Z 08 unknown /C=DE/CN=Test Certificate for revocation 3/emailAddress=suse@suse.de
+R 110612215132Z 100612215133Z,CAkeyTime,20100612213452Z 09 unknown /C=DE/CN=Test Certificate for revocation 4/emailAddress=suse@suse.de
+R 110612215133Z 100612215135Z,holdInstruction,1.6.21.43 0A unknown /C=DE/CN=Test Certificate for revocation 5 oid test/emailAddress=suse@suse.de
+V 120611215136Z 0B unknown /C=DE/CN=Test Sub CA/emailAddress=suse@suse.de
Modified: limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA2/.rand
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA2/.rand?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
Binary files - no diff available.
Modified: limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA2/crl/crl.pem
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA2/crl/crl.pem?rev=2672&r1=2671&r2=2672&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA2/crl/crl.pem (original)
+++ limal-branches/mc-devel/limal-ca-mgm/testsuite/TestRepos/Test_CA2/crl/crl.pem Sat Jun 12 23:53:00 2010
@@ -1,7 +1,7 @@
-----BEGIN X509 CRL-----
MIIC+TCCAeECAQEwDQYJKoZIhvcNAQEFBQAwQzELMAkGA1UEBhMCREUxFzAVBgNV
BAMTDlN0YXRpYyBUZXN0IENBMRswGQYJKoZIhvcNAQkBFgxzdXNlQHN1c2UuZGUX
-DTEwMDYxMjEzMzI0MloXDTEwMDYxMzEzMzI0MlowgfAwEgIBAxcNMDUwODE4MTQx
+DTEwMDYxMjIxNTEzOFoXDTEwMDYxMzIxNTEzOFowgfAwEgIBAxcNMDUwODE4MTQx
MzIzWjAyAgEEFw0wNTA4MTgxNDEzMjVaMB4wCgYDVR0VBAMKAQYwEAYDVR0XBAkG
ByqGSM44AgIwOgIBBRcNMDUwODE4MTQxMzI2WjAmMAoGA1UdFQQDCgEBMBgGA1Ud
GAQRGA8yMDA1MDgxODE1NTY0NlowOgIBBhcNMDUwODE4MTQxMzI4WjAmMAoGA1Ud
@@ -9,10 +9,10 @@
ODE4WjAaMAoGA1UdFQQDCgEGMAwGA1UdFwQFBgMuFSugdzB1MHMGA1UdIwRsMGqA
FDIAwASkKojCPsrVvdhM01KIIH87oUekRTBDMQswCQYDVQQGEwJERTEXMBUGA1UE
AxMOU3RhdGljIFRlc3QgQ0ExGzAZBgkqhkiG9w0BCQEWDHN1c2VAc3VzZS5kZYIJ
-AI7xzphhj2SdMA0GCSqGSIb3DQEBBQUAA4IBAQBX/NdnQGnTnXoCUolvtVcY/Av3
-bkp8o8AXuNJ7UYndgqCF1Im5xT2c8ZVVftolb/ThgseCKbeFZJ3vMdkZOfqZuITh
-jrbgYgmkUKohCsJG5NmvGIpdTRGszreVoVbWz7Gp25qSmUgq+7VGD6Zj2NwmNKFH
-5YJfYdwRw2lsY0tfkNSlVqxO2XeBDqAqm2+4vLdPPpba2UfbiIoEF2LLKHT+43VP
-kfwzB5tgngtab8AZ+5kFPlcbghxfYb1ajHF5LnCjb5kM3Xj6NP4t8bszM5omnKVf
-ZTi4J99C7uShLnxYxN1Oh5u2QHOPvSlBLaLEfj8tbdOPzEmMheuGh/y0cgMb
+AI7xzphhj2SdMA0GCSqGSIb3DQEBBQUAA4IBAQAuCzexvYgJxzwNNm0CNqu++P6D
+9QloSbMtTl+eZZb8xtXHo7ZKRBXfWdIulv8INN5S3lLZMKxUvbrUWPdRNWvGBAS2
+iFdOykY/KUr25u/MGkIadqObtViyYPK4zPozEdegqOPcR7h5sDMCd76rkaqLP5tS
+vg98Sfthx96uAdxKPuKl4Kz9r4h6TbVC98aIjpi6VIAtiZGX9i+GQt7Rf8thi04f
+46DZNbbBmDbFSzgyc4H94qPx3HHgMAmnrNXRgjcjQjXuPJTT/1x+zRArR97c+tRt
+k9jvziQPQIp1K1XVewlXYAM7BYhyy7wwEZalarOqCmoagJNqpWyzGT5wwqbT
-----END X509 CRL-----
--
To unsubscribe, e-mail: limal-commit+unsubscribe@opensuse.org
For additional commands, e-mail: limal-commit+help@opensuse.org