Author: mcalmer
Date: Fri Aug 13 17:53:26 2010
New Revision: 2697
URL: http://svn.opensuse.org/viewcvs/limal?rev=2697&view=rev
Log:
replace Exec with ExternalProgram from zypp
Added:
limal-branches/mc-devel/limal-ca-mgm/src/ExternalDataSource.cpp
limal-branches/mc-devel/limal-ca-mgm/src/ExternalProgram.cpp
limal-branches/mc-devel/limal-ca-mgm/src/limal/ExternalDataSource.hpp
limal-branches/mc-devel/limal-ca-mgm/src/limal/ExternalProgram.hpp
Modified:
limal-branches/mc-devel/limal-ca-mgm/configure.in
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/OpenSSLUtils.hpp
limal-branches/mc-devel/limal-ca-mgm/src/PathName.cpp
limal-branches/mc-devel/limal-ca-mgm/src/PathUtils.cpp
limal-branches/mc-devel/limal-ca-mgm/src/Utils.cpp
limal-branches/mc-devel/limal-ca-mgm/src/Utils.hpp
limal-branches/mc-devel/limal-ca-mgm/src/limal/Makefile.am
limal-branches/mc-devel/limal-ca-mgm/src/limal/PathInfo.hpp
limal-branches/mc-devel/limal-ca-mgm/src/limal/PathName.hpp
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/configure.in
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/configure.in?rev=2697&r1=2696&r2=2697&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/configure.in (original)
+++ limal-branches/mc-devel/limal-ca-mgm/configure.in Fri Aug 13 17:53:26 2010
@@ -202,6 +202,11 @@
AC_MSG_ERROR([cannot find LIBSSL])
fi
+AC_CHECK_LIB(util, main, [LIB_UTIL="-lutil"], [LIB_UTIL=""])
+if test -z "$LIB_UTIL"; then
+ AC_MSG_ERROR([cannot find LIBUTIL])
+fi
+
# FIXME: remove me after PathUtils review
AC_PATH_PROG(CP_COMMAND, "cp")
if test -z "$CP_COMMAND" ; then
@@ -217,6 +222,7 @@
AC_SUBST(RM_COMMAND)
AC_SUBST(LIB_SSL)
+AC_SUBST(LIB_UTIL)
#AC_ARG_ENABLE(debug,[ --enable-debug debug msg for Rep ],[DEBUG_FLAGS="-DCA_MGM_DEBUG"])
#AC_SUBST(DEBUG_FLAGS)
Added: limal-branches/mc-devel/limal-ca-mgm/src/ExternalDataSource.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/ExternalDataSource.cpp?rev=2697&view=auto
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/ExternalDataSource.cpp (added)
+++ limal-branches/mc-devel/limal-ca-mgm/src/ExternalDataSource.cpp Fri Aug 13 17:53:26 2010
@@ -0,0 +1,171 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/base/ExternalDataSource.cc
+ *
+ * \todo replace by Blocxx
+ *
+*/
+
+#define _GNU_SOURCE 1 // for ::getline
+
+#include
+#include
+#include
+#include
+#include
+#include <iostream>
+#include
+#include
+
+#include <string>
+
+#include
+#include
+
+using namespace std;
+
+namespace ca_mgm {
+
+ ExternalDataSource::ExternalDataSource (FILE *ifile, FILE *ofile)
+ : inputfile (ifile),
+ outputfile (ofile),
+ linebuffer (0),
+ linebuffer_size (0)
+ {
+ }
+
+
+ ExternalDataSource::~ExternalDataSource ()
+ {
+ if (linebuffer)
+ free (linebuffer);
+ close ();
+ }
+
+
+ bool
+ ExternalDataSource::send (const char *buffer, size_t length)
+ {
+ if (outputfile) {
+ bool success = fwrite (buffer, length, 1, outputfile) != 0;
+ fflush (outputfile);
+ return success;
+ }
+ else
+ return false;
+ }
+
+
+ bool
+ ExternalDataSource::send (std::string s)
+ {
+ DBG << "send (" << s << ")";
+ return send(s.data(), s.length());
+ }
+
+
+ string
+ ExternalDataSource::receiveUpto (char c)
+ {
+ if (inputfile)
+ {
+ string result;
+ while (true)
+ {
+ const size_t length = 4096;
+ char buffer[length];
+ char *writepointer = buffer;
+ size_t readbytes = 0;
+ int readc = -1;
+
+ while (!feof(inputfile) && readbytes < length)
+ {
+ readc = fgetc(inputfile);
+ if (readc == EOF) break;
+ *writepointer++ = (char) readc;
+ if ((char) readc == c) break;
+ readbytes++;
+ }
+ *writepointer = 0;
+ result += buffer;
+ if (readbytes < length || (char) readc == c) break;
+
+ }
+ return result;
+ }
+
+ else return "";
+ }
+
+
+ size_t
+ ExternalDataSource::receive (char *buffer, size_t length)
+ {
+ if (inputfile)
+ return fread (buffer, 1, length, inputfile);
+ else
+ return 0;
+ }
+
+ void ExternalDataSource::setBlocking(bool mode)
+ {
+ if(!inputfile) return;
+
+ int fd = ::fileno(inputfile);
+
+ if(fd == -1)
+ { ERR << strerror(errno) << endl; return; }
+
+ int flags = ::fcntl(fd,F_GETFL);
+
+ if(flags == -1)
+ { ERR << strerror(errno) << endl; return; }
+
+ if(!mode)
+ flags = flags | O_NONBLOCK;
+ else if(flags & O_NONBLOCK)
+ flags = flags ^ O_NONBLOCK;
+
+ flags = ::fcntl(fd,F_SETFL,flags);
+
+ if(flags == -1)
+ { ERR << strerror(errno) << endl; return; }
+ }
+
+ string
+ ExternalDataSource::receiveLine()
+ {
+ if (inputfile)
+ {
+ ssize_t nread = getline (&linebuffer, &linebuffer_size, inputfile);
+ if (nread == -1)
+ return "";
+ else
+ return string (linebuffer, nread);
+ }
+ else
+ return "";
+ }
+
+
+ int
+ ExternalDataSource::close ()
+ {
+ if (inputfile && inputfile != outputfile)
+ fclose (inputfile);
+ if (outputfile)
+ fclose (outputfile);
+ inputfile = 0;
+ outputfile = 0;
+ return 0;
+ }
+
+
+} // namespace ca_mgm
+
Added: limal-branches/mc-devel/limal-ca-mgm/src/ExternalProgram.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/ExternalProgram.cpp?rev=2697&view=auto
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/ExternalProgram.cpp (added)
+++ limal-branches/mc-devel/limal-ca-mgm/src/ExternalProgram.cpp Fri Aug 13 17:53:26 2010
@@ -0,0 +1,484 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/ExternalProgram.cc
+*/
+
+#define _GNU_SOURCE 1 // for ::getline
+
+#include
+#include
+#include
+#include
+#include
+#include // openpty
+#include // setenv
+
+#include <cstring> // strsignal
+#include <iostream>
+#include <sstream>
+
+#include
+#include
+#include
+
+#include "Utils.hpp"
+
+using namespace std;
+using namespace ca_mgm::path;
+
+namespace ca_mgm {
+
+ ExternalProgram::ExternalProgram()
+ : use_pty (false)
+ {
+ }
+
+
+ ExternalProgram::ExternalProgram( std::string commandline,
+ Stderr_Disposition stderr_disp,
+ bool use_pty,
+ int stderr_fd,
+ bool default_locale,
+ const PathName & root )
+ : use_pty (use_pty)
+ {
+ const char *argv[4];
+ argv[0] = "/bin/sh";
+ argv[1] = "-c";
+ argv[2] = commandline.c_str();
+ argv[3] = 0;
+
+ const char* rootdir = NULL;
+ if(!root.empty() && root != "/")
+ {
+ rootdir = root.asString().c_str();
+ }
+ Environment environment;
+ start_program (argv, environment, stderr_disp, stderr_fd, default_locale, rootdir);
+ }
+
+
+ ExternalProgram::ExternalProgram (const Arguments &argv,
+ Stderr_Disposition stderr_disp,
+ bool use_pty, int stderr_fd,
+ bool default_locale,
+ const PathName& root)
+ : use_pty (use_pty)
+ {
+ const char * argvp[argv.size() + 1];
+ unsigned c = 0;
+ for_( i, argv.begin(), argv.end() )
+ {
+ argvp[c] = i->c_str();
+ ++c;
+ }
+ argvp[c] = 0;
+
+ Environment environment;
+ const char* rootdir = NULL;
+ if(!root.empty() && root != "/")
+ {
+ rootdir = root.asString().c_str();
+ }
+ start_program (argvp, environment, stderr_disp, stderr_fd, default_locale, rootdir);
+ }
+
+
+ ExternalProgram::ExternalProgram (const Arguments &argv,
+ const Environment & environment,
+ Stderr_Disposition stderr_disp,
+ bool use_pty, int stderr_fd,
+ bool default_locale,
+ const PathName& root)
+ : use_pty (use_pty)
+ {
+ const char * argvp[argv.size() + 1];
+ unsigned c = 0;
+ for_( i, argv.begin(), argv.end() )
+ {
+ argvp[c] = i->c_str();
+ ++c;
+ }
+ argvp[c] = 0;
+
+ const char* rootdir = NULL;
+ if(!root.empty() && root != "/")
+ {
+ rootdir = root.asString().c_str();
+ }
+ start_program (argvp, environment, stderr_disp, stderr_fd, default_locale, rootdir);
+
+ }
+
+
+
+
+ ExternalProgram::ExternalProgram( const char *const *argv,
+ Stderr_Disposition stderr_disp,
+ bool use_pty,
+ int stderr_fd,
+ bool default_locale,
+ const PathName & root )
+ : use_pty (use_pty)
+ {
+ const char* rootdir = NULL;
+ if(!root.empty() && root != "/")
+ {
+ rootdir = root.asString().c_str();
+ }
+ Environment environment;
+ start_program (argv, environment, stderr_disp, stderr_fd, default_locale, rootdir);
+ }
+
+
+ ExternalProgram::ExternalProgram (const char *const *argv, const Environment & environment,
+ Stderr_Disposition stderr_disp, bool use_pty,
+ int stderr_fd, bool default_locale,
+ const PathName& root)
+ : use_pty (use_pty)
+ {
+ const char* rootdir = NULL;
+ if(!root.empty() && root != "/")
+ {
+ rootdir = root.asString().c_str();
+ }
+ start_program (argv, environment, stderr_disp, stderr_fd, default_locale, rootdir);
+ }
+
+
+ ExternalProgram::ExternalProgram (const char *binpath, const char *const *argv_1,
+ bool use_pty)
+ : use_pty (use_pty)
+ {
+ int i = 0;
+ while (argv_1[i++])
+ ;
+ const char *argv[i + 1];
+ argv[0] = binpath;
+ memcpy (&argv[1], argv_1, (i - 1) * sizeof (char *));
+ Environment environment;
+ start_program (argv, environment);
+ }
+
+
+ ExternalProgram::ExternalProgram (const char *binpath, const char *const *argv_1, const Environment & environment,
+ bool use_pty)
+ : use_pty (use_pty)
+ {
+ int i = 0;
+ while (argv_1[i++])
+ ;
+ const char *argv[i + 1];
+ argv[0] = binpath;
+ memcpy (&argv[1], argv_1, (i - 1) * sizeof (char *));
+ start_program (argv, environment);
+ }
+
+
+ ExternalProgram::~ExternalProgram()
+ {
+ }
+
+
+ void
+ ExternalProgram::start_program (const char *const *argv, const Environment & environment,
+ Stderr_Disposition stderr_disp,
+ int stderr_fd, bool default_locale, const char* root)
+ {
+ pid = -1;
+ _exitStatus = 0;
+ int to_external[2], from_external[2]; // fds for pair of pipes
+ int master_tty, slave_tty; // fds for pair of ttys
+
+ // do not remove the single quotes around every argument, copy&paste of
+ // command to shell will not work otherwise!
+ {
+ stringstream cmdstr;
+ for (int i = 0; argv[i]; i++)
+ {
+ if (i>0) cmdstr << ' ';
+ cmdstr << '\'';
+ cmdstr << argv[i];
+ cmdstr << '\'';
+ }
+ _command = cmdstr.str();
+ }
+ //DBG << "Executing " << _command << endl;
+
+
+ if (use_pty)
+ {
+ // Create pair of ttys
+ DBG << "Using ttys for communication with " << argv[0] << endl;
+ if (openpty (&master_tty, &slave_tty, 0, 0, 0) != 0)
+ {
+ _execError = str::form( __("Can't open pty (%s)."), strerror(errno) );
+ _exitStatus = 126;
+ ERR << _execError << endl;
+ return;
+ }
+ }
+ else
+ {
+ // Create pair of pipes
+ if (pipe (to_external) != 0 || pipe (from_external) != 0)
+ {
+ _execError = str::form( __("Can't open pipe (%s)."), strerror(errno) );
+ _exitStatus = 126;
+ ERR << _execError << endl;
+ return;
+ }
+ }
+
+ // Create module process
+ if ((pid = fork()) == 0)
+ {
+ if (use_pty)
+ {
+ setsid();
+ if(slave_tty != 1)
+ dup2 (slave_tty, 1); // set new stdout
+ renumber_fd (slave_tty, 0); // set new stdin
+ ::close(master_tty); // Belongs to father process
+
+ // We currently have no controlling terminal (due to setsid).
+ // The first open call will also set the new ctty (due to historical
+ // unix guru knowledge ;-) )
+
+ char name[512];
+ ttyname_r(slave_tty, name, sizeof(name));
+ ::close(open(name, O_RDONLY));
+ }
+ else
+ {
+ renumber_fd (to_external[0], 0); // set new stdin
+ ::close(from_external[0]); // Belongs to father process
+
+ renumber_fd (from_external[1], 1); // set new stdout
+ ::close(to_external [1]); // Belongs to father process
+ }
+
+ // Handle stderr
+ if (stderr_disp == Discard_Stderr)
+ {
+ int null_fd = open("/dev/null", O_WRONLY);
+ dup2(null_fd, 2);
+ ::close(null_fd);
+ }
+ else if (stderr_disp == Stderr_To_Stdout)
+ {
+ dup2(1, 2);
+ }
+ else if (stderr_disp == Stderr_To_FileDesc)
+ {
+ // Note: We don't have to close anything regarding stderr_fd.
+ // Our caller is responsible for that.
+ dup2 (stderr_fd, 2);
+ }
+
+ for ( Environment::const_iterator it = environment.begin(); it != environment.end(); ++it ) {
+ setenv( it->first.c_str(), it->second.c_str(), 1 );
+ }
+
+ if(default_locale)
+ setenv("LC_ALL","C",1);
+
+ if(root)
+ {
+ if(chroot(root) == -1)
+ {
+ _execError = str::form( __("Can't chroot to '%s' (%s)."), root, strerror(errno) );
+ ERR << _execError << endl;
+ std::cerr << _execError << endl;// After fork log on stderr too
+ _exit (128); // No sense in returning! I am forked away!!
+ }
+ if(chdir("/") == -1)
+ {
+ _execError = str::form( __("Can't chdir to '/' inside chroot (%s)."), strerror(errno) );
+ ERR << _execError << endl;
+ std::cerr << _execError << endl;// After fork log on stderr too
+ _exit (128); // No sense in returning! I am forked away!!
+ }
+ }
+
+ // close all filedesctiptors above stderr
+ for ( int i = ::getdtablesize() - 1; i > 2; --i ) {
+ ::close( i );
+ }
+
+ execvp(argv[0], const_cast(argv));
+ // don't want to get here
+ _execError = str::form( __("Can't exec '%s' (%s)."), argv[0], strerror(errno) );
+ ERR << _execError << endl;
+ std::cerr << _execError << endl;// After fork log on stderr too
+ _exit (129); // No sense in returning! I am forked away!!
+ }
+
+ else if (pid == -1) // Fork failed, close everything.
+ {
+ _execError = str::form( __("Can't fork (%s)."), strerror(errno) );
+ _exitStatus = 127;
+ ERR << _execError << endl;
+
+ if (use_pty) {
+ ::close(master_tty);
+ ::close(slave_tty);
+ }
+ else {
+ ::close(to_external[0]);
+ ::close(to_external[1]);
+ ::close(from_external[0]);
+ ::close(from_external[1]);
+ }
+ }
+
+ else {
+ if (use_pty)
+ {
+ ::close(slave_tty); // belongs to child process
+ inputfile = fdopen(master_tty, "r");
+ outputfile = fdopen(master_tty, "w");
+ }
+ else
+ {
+ ::close(to_external[0]); // belongs to child process
+ ::close(from_external[1]); // belongs to child process
+ inputfile = fdopen(from_external[0], "r");
+ outputfile = fdopen(to_external[1], "w");
+ }
+
+ //DBG << "pid " << pid << " launched" << endl;
+
+ if (!inputfile || !outputfile)
+ {
+ ERR << "Cannot create streams to external program " << argv[0] << endl;
+ close();
+ }
+ }
+ }
+
+
+ int
+ ExternalProgram::close()
+ {
+ if (pid > 0)
+ {
+ ExternalDataSource::close();
+ // Wait for child to exit
+ int ret;
+ int status = 0;
+ do
+ {
+ ret = waitpid(pid, &status, 0);
+ }
+ while (ret == -1 && errno == EINTR);
+
+ if (ret != -1)
+ {
+ status = checkStatus( status );
+ }
+ pid = -1;
+ return status;
+ }
+ else
+ {
+ return _exitStatus;
+ }
+ }
+
+
+ int ExternalProgram::checkStatus( int status )
+ {
+ if (WIFEXITED (status))
+ {
+ status = WEXITSTATUS (status);
+ if(status)
+ {
+ DBG << "Pid " << pid << " exited with status " << status << endl;
+ _execError = str::form( __("Command exited with status %d."), status );
+ }
+ else
+ {
+ // if 'launch' is logged, completion should be logged,
+ // even if successfull.
+ //DBG << "Pid " << pid << " successfully completed" << endl;
+ //_execError = __("Command successfully completed.");
+ }
+ }
+ else if (WIFSIGNALED (status))
+ {
+ status = WTERMSIG (status);
+ WAR << "Pid " << pid << " was killed by signal " << status
+ << " (" << strsignal(status);
+ if (WCOREDUMP (status))
+ {
+ WAR << ", core dumped";
+ }
+ WAR << ")" << endl;
+ _execError = str::form( __("Command was killed by signal %d (%s)."), status, strsignal(status) );
+ status+=128;
+ }
+ else {
+ ERR << "Pid " << pid << " exited with unknown error" << endl;
+ _execError = __("Command exited with unknown error.");
+ }
+
+ return status;
+ }
+
+ bool
+ ExternalProgram::kill()
+ {
+ if (pid > 0)
+ {
+ ::kill(pid, SIGKILL);
+ close();
+ }
+ return true;
+ }
+
+
+ bool
+ ExternalProgram::running()
+ {
+ if ( pid < 0 ) return false;
+
+ int status = 0;
+ int p = waitpid( pid, &status, WNOHANG );
+ switch ( p )
+ {
+ case -1:
+ ERR << "waitpid( " << pid << ") returned error '" << strerror(errno) << "'" << endl;
+ return false;
+ break;
+ case 0:
+ return true; // still running
+ break;
+ }
+
+ // Here: completed...
+ _exitStatus = checkStatus( status );
+ pid = -1;
+ return false;
+ }
+
+ // origfd will be accessible as newfd and closed (unless they were equal)
+ void ExternalProgram::renumber_fd (int origfd, int newfd)
+ {
+ // It may happen that origfd is already the one we want
+ // (Although in our circumstances, that would mean somebody has closed
+ // our stdin or stdout... weird but has appened to Cray, #49797)
+ if (origfd != newfd)
+ {
+ dup2 (origfd, newfd);
+ ::close (origfd);
+ }
+ }
+
+} // 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=2697&r1=2696&r2=2697&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/Makefile.am (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/Makefile.am Fri Aug 13 17:53:26 2010
@@ -77,7 +77,9 @@
OpenSSLUtils.cpp \
INIParser/IniFile.cpp \
INIParser/IniParser.cpp \
- INIParser/INIParser.cpp
+ INIParser/INIParser.cpp \
+ ExternalProgram.cpp \
+ ExternalDataSource.cpp
# config.cpp \
liblimal_ca_mgm_la_CXXFLAGS = $(LIMAL_CFLAGS)
@@ -86,7 +88,7 @@
-version-info $(LIB_VERSION_INFO) \
$(LIMAL_LIBS) -lssl
-liblimal_ca_mgm_la_LIBADD = $(LIB_SSL)
+liblimal_ca_mgm_la_LIBADD = $(LIB_SSL) $(LIB_UTIL)
CLEANFILES = *~
DISTCLEANFILES = Commands.hpp Utils.hpp config.log
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=2697&r1=2696&r2=2697&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/OpenSSLUtils.cpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/OpenSSLUtils.cpp Fri Aug 13 17:53:26 2010
@@ -26,8 +26,6 @@
#include
#include
#include
-#include
-#include
#include
#include
#include <fstream>
@@ -108,11 +106,10 @@
LOGIT_DEBUG("Command: " << debugCmd);
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", m_rand.c_str());
-
- env.addVar("pass", password.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = m_rand.c_str();
+ env["pass"] = password.c_str();
std::string stdOutput;
std::string errOutput;
@@ -199,11 +196,10 @@
LOGIT_DEBUG("Command: " << debugCmd);
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", m_rand.c_str());
-
- env.addVar("pass", password.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = m_rand.c_str();
+ env["pass"] = password.c_str();
std::string stdOutput;
std::string errOutput;
@@ -299,11 +295,10 @@
LOGIT_DEBUG("Command: " << debugCmd);
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", m_rand.c_str());
-
- env.addVar("pass", password.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = m_rand.c_str();
+ env["pass"] = password.c_str();
std::string stdOutput;
std::string errOutput;
@@ -425,11 +420,10 @@
LOGIT_DEBUG("Command: " << debugCmd);
//LOGIT_DEBUG("PASSWORD: " << caPassword);
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", m_rand.c_str());
-
- env.addVar("pass", caPassword.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = m_rand.c_str();
+ env["pass"] = caPassword.c_str();
std::string stdOutput;
std::string errOutput;
@@ -565,11 +559,10 @@
LOGIT_DEBUG("Command: " << debugCmd);
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", m_rand.c_str());
-
- env.addVar("pass", caPassword.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = m_rand.c_str();
+ env["pass"] = caPassword.c_str();
std::string stdOutput;
std::string errOutput;
@@ -667,11 +660,10 @@
LOGIT_DEBUG("Command: " << debugCmd);
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", m_rand.c_str());
-
- env.addVar("pass", caPassword.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = m_rand.c_str();
+ env["pass"] = caPassword.c_str();
std::string stdOutput;
std::string errOutput;
@@ -751,11 +743,10 @@
LOGIT_DEBUG("Command: " << debugCmd);
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", m_rand.c_str());
-
- env.addVar("pass", caPassword.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = m_rand.c_str();
+ env["pass"] = caPassword.c_str();
std::string stdOutput;
std::string errOutput;
@@ -844,9 +835,9 @@
LOGIT_DEBUG("Command: " << debugCmd);
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", m_rand.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = m_rand.c_str();
std::string stdOutput;
std::string errOutput;
@@ -925,9 +916,9 @@
LOGIT_DEBUG("Command: " << debugCmd);
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", m_rand.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = m_rand.c_str();
std::string stdOutput;
std::string errOutput;
@@ -1022,11 +1013,10 @@
LOGIT_DEBUG("Command: " << debugCmd);
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", m_rand.c_str());
-
- env.addVar("PASSWORD", password.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = m_rand.c_str();
+ env["PASSWORD"] = password.c_str();
std::string stdOutput;
std::string errOutput;
@@ -1109,10 +1099,10 @@
LOGIT_DEBUG("Command: " << debugCmd);
- std::string randfile(::tempnam("/tmp/", ".rand-"));
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", randfile.c_str());
+ std::string randfile(::tempnam("/tmp/", ".rand-"));
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = randfile.c_str();
std::string stdOutput;
std::string errOutput;
int status = -1;
@@ -1239,18 +1229,18 @@
LOGIT_DEBUG("Command: " << debugCmd);
std::string randfile(::tempnam("/tmp/", ".rand-"));
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", randfile.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = randfile.c_str();
if(isInPassSet)
{
- env.addVar("inpass", inPassword.c_str());
+ env["inpass"] = inPassword.c_str();
}
if(isOutPassSet)
{
- env.addVar("outpass", outPassword.c_str());
+ env["outpass"] = outPassword.c_str();
}
std::string stdOutput;
@@ -1375,9 +1365,9 @@
LOGIT_DEBUG("Command: " << debugCmd);
std::string randfile(::tempnam("/tmp/", ".rand-"));
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", randfile.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = randfile.c_str();
std::string stdOutput;
std::string errOutput;
int status = -1;
@@ -1484,9 +1474,9 @@
LOGIT_DEBUG("Command: " << debugCmd);
std::string randfile(::tempnam("/tmp/", ".rand-"));
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", randfile.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = randfile.c_str();
std::string stdOutput;
std::string errOutput;
int status = -1;
@@ -1626,18 +1616,18 @@
LOGIT_DEBUG("Command: " << debugCmd);
std::string randfile(::tempnam("/tmp/", ".rand-"));
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", randfile.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = randfile.c_str();
if(isInPassSet)
{
- env.addVar("inpass", inPassword.c_str());
+ env["inpass"] = inPassword.c_str();
}
if(isOutPassSet)
{
- env.addVar("outpass", outPassword.c_str());
+ env["outpass"] = outPassword.c_str();
}
std::string stdOutput;
@@ -1775,18 +1765,18 @@
LOGIT_DEBUG("Command: " << debugCmd);
std::string randfile(::tempnam("/tmp/", ".rand-"));
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", randfile.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = randfile.c_str();
if(isInPassSet)
{
- env.addVar("inpass", inPassword.c_str());
+ env["inpass"] = inPassword.c_str();
}
if(isOutPassSet)
{
- env.addVar("outpass", outPassword.c_str());
+ env["outpass"] = outPassword.c_str();
}
std::string stdOutput;
@@ -2577,9 +2567,9 @@
LOGIT_DEBUG("Command: " << dcmd);
std::string randfile(::tempnam("/tmp/", ".rand-"));
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
- env.addVar("RANDFILE", randfile.c_str());
+ Environment env;
+ env["PATH"] = "/usr/bin/";
+ env["RANDFILE"] = randfile.c_str();
std::string stdOutput;
std::string errOutput;
Modified: limal-branches/mc-devel/limal-ca-mgm/src/OpenSSLUtils.hpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/OpenSSLUtils.hpp?rev=2697&r1=2696&r2=2697&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/OpenSSLUtils.hpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/OpenSSLUtils.hpp Fri Aug 13 17:53:26 2010
@@ -29,6 +29,7 @@
#include
#include
#include
+#include
#include "Commands.hpp"
@@ -37,6 +38,8 @@
class OpenSSLUtils {
+ typedef ExternalProgram::Environment Environment;
+
public:
OpenSSLUtils(const std::string &onfigFile,
Modified: limal-branches/mc-devel/limal-ca-mgm/src/PathName.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/PathName.cpp?rev=2697&r1=2696&r2=2697&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/PathName.cpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/PathName.cpp Fri Aug 13 17:53:26 2010
@@ -254,7 +254,7 @@
}
std::string
- getPathName(const std::string &sep = BLOCXX_FILENAME_SEPARATOR) const
+ getPathName(const std::string &sep = FILENAME_SEPARATOR) const
{
if( m_first)
return "";
@@ -516,7 +516,7 @@
PathName ret( name);
- size_t idx = ret.m_name.find_last_of( BLOCXX_FILENAME_SEPARATOR_C);
+ size_t idx = ret.m_name.find_last_of( FILENAME_SEPARATOR_C);
if ( idx == std::string::npos)
{
ret.m_name.erase( ret.m_prefix);
@@ -525,7 +525,7 @@
else if ( idx == ret.m_prefix )
{
ret.m_name.erase( ret.m_prefix);
- ret.m_name += BLOCXX_FILENAME_SEPARATOR;
+ ret.m_name += FILENAME_SEPARATOR;
}
else
{
@@ -547,7 +547,7 @@
std::string ret( name.toString());
ret.erase( 0, name.m_prefix);
- size_t idx = ret.find_last_of( BLOCXX_FILENAME_SEPARATOR_C);
+ size_t idx = ret.find_last_of( FILENAME_SEPARATOR_C);
if ( idx != std::string::npos)
{
ret.erase( 0, idx + 1);
@@ -562,7 +562,7 @@
PathName
PathName::absoluteName(const PathName &name)
{
- return name.relative() ? cat( BLOCXX_FILENAME_SEPARATOR, name) : name;
+ return name.relative() ? cat( FILENAME_SEPARATOR, name) : name;
}
@@ -610,7 +610,7 @@
if ( name.empty())
return add;
- std::string ret = BLOCXX_FILENAME_SEPARATOR +
+ std::string ret = FILENAME_SEPARATOR +
add.toString().substr(add.m_prefix) ;
return PathName(name.toString() + ret);
Modified: limal-branches/mc-devel/limal-ca-mgm/src/PathUtils.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/PathUtils.cpp?rev=2697&r1=2696&r2=2697&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/PathUtils.cpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/PathUtils.cpp Fri Aug 13 17:53:26 2010
@@ -27,12 +27,10 @@
#include
#include
-#include
namespace LIMAL_NAMESPACE {
namespace path {
-using namespace blocxx;
inline static std::string mode2String(mode_t o) {
std::string s;
@@ -157,7 +155,7 @@
int status = -1;
try {
status = wrapExecuteProcessAndGatherOutput(
- cmd, stdOutput, errOutput, EnvVars()
+ cmd, stdOutput, errOutput
);
}
catch(const ca_mgm::Exception &e) {
@@ -215,7 +213,7 @@
int status = -1;
try {
status = wrapExecuteProcessAndGatherOutput(
- cmd, stdOutput, errOutput, EnvVars()
+ cmd, stdOutput, errOutput
);
}
catch(const ca_mgm::Exception &e) {
@@ -353,7 +351,7 @@
int status = -1;
try {
status = wrapExecuteProcessAndGatherOutput(
- cmd, stdOutput, errOutput, EnvVars()
+ cmd, stdOutput, errOutput
);
}
catch(const ca_mgm::Exception &e) {
Modified: limal-branches/mc-devel/limal-ca-mgm/src/Utils.cpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/Utils.cpp?rev=2697&r1=2696&r2=2697&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/Utils.cpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/Utils.cpp Fri Aug 13 17:53:26 2010
@@ -29,6 +29,11 @@
#include
#include
#include
+#include
+#include
+#include
+#include
+#include
// -------------------------------------------------------------------
namespace CA_MGM_NAMESPACE
@@ -68,45 +73,87 @@
// -------------------------------------------------------------------
int wrapExecuteProcessAndGatherOutput(
- const std::vectorstd::string &cmd,
- std::string &out,
- std::string &err,
- const blocxx::EnvVars &env
+ const ExternalProgram::Arguments &cmd,
+ std::string &out,
+ std::string &err,
+ const ExternalProgram::Environment &env
)
{
- int exitStatus = -1;
- int tmax=-1;
- int omax=-1;
- std::string in=std::string();
-
- blocxx::Process::Status status;
-
- status = blocxx::Exec::executeProcessAndGatherOutput(
- blocxx::StringArray(cmd.begin(), cmd.end()),
- out, err, env,
- ( tmax < 0 ? blocxx::Timeout::infinite :
- blocxx::Timeout::relative(float(tmax))
- ),
- omax, in
- );
-
- if( status.exitTerminated())
- {
- exitStatus = status.exitStatus();
- }
- else
- if( status.signalTerminated())
- {
- LOGIT_ERROR("Command '" << cmd[0]
- << "' terminated by signal: "
- << status.termSignal());
- }
- else
- {
- LOGIT_ERROR("Command '" << cmd[0]
- << "' execution in unknown state");
- }
- return exitStatus;
+ int exitStatus = -1;
+ /*
+ std::string tmperr(::tempnam("/tmp/", "errfd"));
+ int errfd = open(tmperr.c_str(), O_CREAT|O_RDWR|O_EXCL);
+ if(errfd == -1)
+ {
+ ERR << "Cannot open file: " << str::strerror(errno) << std::endl;
+ return exitStatus;
+ }
+ */
+
+ int stderr_pipes[2];
+
+ // create a pair of pipes
+ if (pipe(stderr_pipes) != 0)
+ {
+ // return current stderr
+ return exitStatus;
+ }
+ // get the current flags
+ int flags = ::fcntl(stderr_pipes[0],F_GETFL);
+ if (flags == -1)
+ {
+ ERR << strerror(errno) << std::endl;
+ return exitStatus;
+ }
+
+ // set the non-blocking flag
+ flags = flags | O_NONBLOCK;
+
+ // set the updated flags
+ flags = ::fcntl(stderr_pipes[0],F_SETFL,flags);
+
+ if (flags == -1)
+ {
+ ERR << strerror(errno) << std::endl;
+ return exitStatus;
+ }
+
+ FILE *stderr_output = ::fdopen(stderr_pipes[0], "r");
+
+ ExternalProgram prog( cmd, env, ExternalProgram::Stderr_To_FileDesc,
+ false, stderr_pipes[1], true);
+
+ std::string line;
+ for(line = prog.receiveLine();
+ ! line.empty();
+ line = prog.receiveLine() )
+ {
+ out += line + "\n";
+ }
+ exitStatus = prog.close();
+
+ //lseek(errfd, 0, SEEK_SET);
+ const unsigned tmpBuffLen = 1024;
+ char tmpBuff[tmpBuffLen];
+ uint len = 0;
+
+ do
+ {
+ len = ::fread(tmpBuff, 1, tmpBuffLen, stderr_output);
+
+ if (len > 0)
+ {
+ err.append(tmpBuff, len);
+ }
+ }
+ while(len == tmpBuffLen);
+ ::fclose(stderr_output);
+
+ if(exitStatus)
+ {
+ //DBG << prog.execError() << std::endl;
+ }
+ return exitStatus;
}
/* FIXME: remove
Modified: limal-branches/mc-devel/limal-ca-mgm/src/Utils.hpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/Utils.hpp?rev=2697&r1=2696&r2=2697&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/Utils.hpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/Utils.hpp Fri Aug 13 17:53:26 2010
@@ -31,12 +31,9 @@
#include
#include
#include
-
+#include
#include
-#include
-#include
-
#include
#include "Commands.hpp"
@@ -66,20 +63,6 @@
} \
} \
-/*
-#define LOGIT_DEBUG_STRINGARRAY(text, stringarray) \
- Logger d("ca-mgm"); \
- if(d.isEnabledFor("DEBUG")) { \
- uint s = stringarray.size(); \
- for(uint i = 0; i < s; i++) { \
- LIMAL_SLOG(d, blocxx::E_DEBUG_LEVEL, \
- text << \
- "(" << (i+1) << "/" << s << "):" \
- << stringarray[i]); \
- } \
- }
-*/
-
// -------------------------------------------------------------------
/**
@@ -258,10 +241,10 @@
// throws or returns the process exit code or -1 (term by signal).
int wrapExecuteProcessAndGatherOutput(
- const std::vectorstd::string &cmd,
- std::string &out,
- std::string &err,
- const blocxx::EnvVars &env
+ const ExternalProgram::Arguments &cmd,
+ std::string &out,
+ std::string &err,
+ const ExternalProgram::Environment &env = ExternalProgram::Environment()
);
inline int rehashCAs(const std::string &repositoryDir)
@@ -270,8 +253,8 @@
cmd.push_back(C_REHASH_COMMAND);
cmd.push_back(repositoryDir);
- blocxx::EnvVars env;
- env.addVar("PATH", "/usr/bin/");
+ ExternalProgram::Environment env;
+ env["PATH"] = "/usr/bin/";
std::string stdOutput;
std::string errOutput;
Added: limal-branches/mc-devel/limal-ca-mgm/src/limal/ExternalDataSource.hpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/limal/ExternalDataSource.hpp?rev=2697&view=auto
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/limal/ExternalDataSource.hpp (added)
+++ limal-branches/mc-devel/limal-ca-mgm/src/limal/ExternalDataSource.hpp Fri Aug 13 17:53:26 2010
@@ -0,0 +1,109 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/base/ExternalDataSource.h
+ *
+ * \todo replace by Blocxx
+ *
+*/
+
+#ifndef CA_MGM_EXTERNALDATASOURCE_H
+#define CA_MGM_EXTERNALDATASOURCE_H
+
+#include
+
+#include <string>
+
+namespace ca_mgm {
+
+ /**
+ * @short Bidirectional stream to external data
+ */
+ class ExternalDataSource
+ {
+ protected:
+ FILE *inputfile;
+ FILE *outputfile;
+
+ private:
+ char *linebuffer;
+ size_t linebuffer_size;
+
+ public:
+ /**
+ * Create a new instance.
+ * @param inputfile The stream for reading
+ * @param outputfile The stream for writing
+ * Either can be NULL if no reading/writing is allowed.
+ */
+ ExternalDataSource(FILE *inputfile = 0, FILE *outputfile = 0);
+
+ /**
+ * Implicitly close the connection.
+ */
+ virtual ~ExternalDataSource();
+
+ /**
+ * Send some data to the output stream.
+ * @param buffer The data to send
+ * @param length The size of it
+ */
+ bool send (const char *buffer, size_t length);
+
+ /**
+ * Send some data down the stream.
+ * @param string The data to send
+ */
+ bool send (std::string s);
+
+ /**
+ * Read some data from the input stream.
+ * @param buffer Where to put the data
+ * @param length How much to read at most
+ * Returns the amount actually received
+ */
+ size_t receive(char *buffer, size_t length);
+
+ /**
+ * Read one line from the input stream.
+ * Returns the line read, including the terminator.
+ */
+ std::string receiveLine();
+
+ /**
+ * Read characters into a string until character c is
+ * read. C is put at the end of the string.
+ */
+ std::string receiveUpto(char c);
+ /**
+ * Set the blocking mode of the input stream.
+ * @param mode True if the reader should be blocked waiting for input.
+ * This is the initial default.
+ */
+ void setBlocking(bool mode);
+
+ /**
+ * Close the input and output streams.
+ */
+ virtual int close();
+
+ /**
+ * Return the input stream.
+ */
+ FILE *inputFile() const { return inputfile; }
+
+ /**
+ * Return the output stream.
+ */
+ FILE *outputFile() const { return outputfile; }
+ };
+
+} // namespace ca_mgm
+
+#endif // CA_MGM_EXTERNALDATASOURCE_H
+
Added: limal-branches/mc-devel/limal-ca-mgm/src/limal/ExternalProgram.hpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/limal/ExternalProgram.hpp?rev=2697&view=auto
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/limal/ExternalProgram.hpp (added)
+++ limal-branches/mc-devel/limal-ca-mgm/src/limal/ExternalProgram.hpp Fri Aug 13 17:53:26 2010
@@ -0,0 +1,197 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/ExternalProgram.h
+*/
+
+
+#ifndef CA_MGM_EXTERNALPROGRAM_H
+#define CA_MGM_EXTERNALPROGRAM_H
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include
+#include
+
+namespace ca_mgm {
+
+ /**
+ * @short Execute a program and give access to its io
+ * An object of this class encapsulates the execution of
+ * an external program. It starts the program using fork
+ * and some exec.. call, gives you access to the program's
+ * stdio and closes the program after use.
+ *
+ * \code
+ *
+ * const char* argv[] =
+ * {
+ * "/usr/bin/foo,
+ * "--option1",
+ * "--option2",
+ * NULL
+ * };
+ *
+ * ExternalProgram prog( argv,
+ * ExternalProgram::Discard_Stderr,
+ * false, -1, true);
+ * string line;
+ * for(line = prog.receiveLine();
+ * ! line.empty();
+ * line = prog.receiveLine() )
+ * {
+ * stream << line;
+ * }
+ * prog.close();
+ *
+ * \endcode
+ */
+ class ExternalProgram : public ExternalDataSource
+ {
+
+ public:
+
+ typedef std::vectorstd::string Arguments;
+
+ /**
+ * Define symbols for different policies on the handling
+ * of stderr
+ */
+ enum Stderr_Disposition {
+ Normal_Stderr,
+ Discard_Stderr,
+ Stderr_To_Stdout,
+ Stderr_To_FileDesc
+ };
+
+
+ /**
+ * For passing additional environment variables to set
+ */
+ typedef std::mapstd::string,std::string Environment;
+
+ /**
+ * Start the external program by using the shell <tt>/bin/sh<tt>
+ * with the option <tt>-c</tt>. You can use io direction symbols < and >.
+ * @param commandline a shell commandline that is appended to
+ * <tt>/bin/sh -c</tt>.
+ * @param default_locale whether to set LC_ALL=C before starting
+ * @param root directory to chroot into, / or empty to not chroot
+ */
+ ExternalProgram (std::string commandline,
+ Stderr_Disposition stderr_disp = Normal_Stderr,
+ bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
+ const path::PathName& root = "");
+
+ /**
+ * Start an external program by giving the arguments as an arry of char *pointers.
+ * If environment is provided, varaiables will be added to the childs environment,
+ * overwriting existing ones.
+ * \throws ExternalProgramException if fork fails.
+ */
+
+ ExternalProgram();
+
+ ExternalProgram (const Arguments &argv,
+ Stderr_Disposition stderr_disp = Normal_Stderr,
+ bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
+ const path::PathName& root = "");
+
+ ExternalProgram (const Arguments &argv, const Environment & environment,
+ Stderr_Disposition stderr_disp = Normal_Stderr,
+ bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
+ const path::PathName& root = "");
+
+ ExternalProgram (const char *const *argv,
+ Stderr_Disposition stderr_disp = Normal_Stderr,
+ bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
+ const path::PathName& root = "");
+
+ ExternalProgram (const char *const *argv, const Environment & environment,
+ Stderr_Disposition stderr_disp = Normal_Stderr,
+ bool use_pty = false, int stderr_fd = -1, bool default_locale = false,
+ const path::PathName& root = "");
+
+ ExternalProgram (const char *binpath, const char *const *argv_1,
+ bool use_pty = false);
+
+
+ ExternalProgram (const char *binpath, const char *const *argv_1, const Environment & environment,
+ bool use_pty = false);
+
+
+ ~ExternalProgram();
+
+ int close();
+
+ /**
+ * Kill the program
+ */
+ bool kill();
+
+ /**
+ * Return whether program is running
+ */
+ bool running();
+
+ /**
+ * return pid
+ * */
+ pid_t getpid() { return pid; }
+
+ /** The command we're executing. */
+ const std::string & command() const
+ { return _command; }
+
+ /** Some detail telling why the execution failed, if it failed.
+ * Empty if the command is still running or successfully completed.
+ *
+ * \li <tt>Can't open pty (%s).</tt>
+ * \li <tt>Can't open pipe (%s).</tt>
+ * \li <tt>Can't fork (%s).</tt>
+ * \li <tt>Command exited with status %d.</tt>
+ * \li <tt>Command was killed by signal %d (%s).</tt>
+ */
+ const std::string & execError() const
+ { return _execError; }
+
+ /**
+ * origfd will be accessible as newfd and closed (unless they were equal)
+ */
+ static void renumber_fd (int origfd, int newfd);
+
+ protected:
+ int checkStatus( int );
+
+ private:
+
+ /**
+ * Set to true, if a pair of ttys is used for communication
+ * instead of a pair of pipes.
+ */
+ bool use_pty;
+
+ pid_t pid;
+ int _exitStatus;
+ /** Store the command we're executing. */
+ std::string _command;
+ /** Remember execution errors like failed fork/exec. */
+ std::string _execError;
+
+ void start_program (const char *const *argv, const Environment & environment,
+ Stderr_Disposition stderr_disp = Normal_Stderr,
+ int stderr_fd = -1, bool default_locale = false,
+ const char* root = NULL);
+
+ };
+
+} // namespace ca_mgm
+
+#endif // CA_MGM_EXTERNALPROGRAM_H
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=2697&r1=2696&r2=2697&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 Fri Aug 13 17:53:26 2010
@@ -26,7 +26,10 @@
String.hpp \
PerlRegEx.hpp \
PosixRegEx.hpp \
- PtrTypes.hpp
+ PtrTypes.hpp \
+ ExternalProgram.hpp \
+ ExternalDataSource.hpp
+
CLEANFILES = *~
Modified: limal-branches/mc-devel/limal-ca-mgm/src/limal/PathInfo.hpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/limal/PathInfo.hpp?rev=2697&r1=2696&r2=2697&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/limal/PathInfo.hpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/limal/PathInfo.hpp Fri Aug 13 17:53:26 2010
@@ -42,11 +42,11 @@
#include
#include
-#include
#include <cerrno>
#include <iosfwd>
#include <set>
+#include <map>
extern "C"
{
@@ -64,7 +64,7 @@
/**
* @class PathInfo
- *
+ *
* @brief Wrapper class for ::stat/::lstat and other file/directory related operations.
*
* This wrapper class for ::stat/::lstat can be used like in the following code fragment:
@@ -75,7 +75,7 @@
* PathInfo pi3( std::string( "/foo/bar/some_file" ); // new object from std::string
* std::cout << "File: \t\t" << pi1 << std::endl;
- * std::cout << "Type: \t\t" << pi1.fileType() << std::endl;
+ * std::cout << "Type: \t\t" << pi1.fileType() << std::endl;
* std::cout << "UID: \t\t" << pi1.owner() << std::endl;
* std::cout << "GID: \t\t" << pi1.group() << std::endl;
* std::cout << "#links: \t" << pi1.nlink() << std::endl;
@@ -87,7 +87,7 @@
* std::cout << "dev: \t\t" << pi1.dev() << std::endl;
* std::cout << "ino: \t\t" << pi1.ino() << std::endl;
*
- * // Using PathInfo::[a,c,m]time()
+ * // Using PathInfo::[a,c,m]time()
* time_t tmpTime = pi1.atime();
* struct tm *timeStruct = localtime( &tmpTime );
* char *timeFormat = "%d.%m.%Y - %X";
@@ -116,7 +116,7 @@
};
/**
- * @brief Overloaded << operator.
+ * @brief Overloaded << operator.
*
* The << operator is overloaded for FileType objects to produce the following
* output:
@@ -128,7 +128,7 @@
* @param str The std::ostream we want to write to.
* @param obj The FileType object we want to be written to the ostream.
*
- * @return A reference to the resulting std::ostream.
+ * @return A reference to the resulting std::ostream.
*/
friend std::ostream & operator<<( std::ostream & str, FileType obj );
friend std::ostream & operator<<( std::ostream & str, const PathInfo &obj);
@@ -157,8 +157,8 @@
/**
- * @brief Constructor to create a PathInfo object from an existing
- * PathName object. Initial stat-mode defaults to E_STAT.
+ * @brief Constructor to create a PathInfo object from an existing
+ * PathName object. Initial stat-mode defaults to E_STAT.
*
* @param path The PathName object used to create the new PathInfo object.
* @param initial The stat-mode used when performing stat operations.
@@ -167,9 +167,9 @@
/**
* @brief Constructor to create a PathInfo object from a std::string.
- * Initial stat-mode defaults to E_STAT.
+ * Initial stat-mode defaults to E_STAT.
*
- * @param path The std::string representing a path which is used
+ * @param path The std::string representing a path which is used
* to create the new PathInfo object.
* @param initial The stat-mode used when performing stat operations.
*/
@@ -177,22 +177,22 @@
/**
* @brief Constructor to create a PathInfo object from a c-string.
- * Initial stat-mode defaults to E_STAT.
+ * Initial stat-mode defaults to E_STAT.
*
- * @param path The c-string representing a path which is used to
- * create the new PathInfo object.
+ * @param path The c-string representing a path which is used to
+ * create the new PathInfo object.
*/
PathInfo( const char * path, Mode initial = E_STAT );
/**
- * @brief Destructor.
+ * @brief Destructor.
*/
virtual ~PathInfo();
-
+
/**
* @brief Returns the PathName object this PathInfo object holds.
* @return The PathName object this PathInfo object holds.
- */
+ */
const PathName path() const { return m_path; }
/**
@@ -200,25 +200,25 @@
* this PathInfo object holds.
* @return A std::string created from the PathName object this PathInfo
* object holds.
- */
+ */
std::string toString() const { return m_path.toString(); }
/**
- * @brief Returns the stat mode which is currently set in this PathInfo
+ * @brief Returns the stat mode which is currently set in this PathInfo
* object.
* @return The [l]stat mode currently set in this object. Can be either
* PathInfo::E_STAT or PathInfo::E_LSTAT.
- */
+ */
Mode mode() const { return m_mode; }
/**
* @brief Returns the internal error code.
*
* Returns '-1' if no (l)stat operations has been performed so far.
- * This can be the case if:
+ * This can be the case if:
* - no path has been set so far
* - path has been changed but no (l)stat operation has been triggered.
*
- * @return The error code.
+ * @return The error code.
*
*/
int error() const { return m_error; }
@@ -226,18 +226,18 @@
/**
* @brief Set the path you want to explore to <b>path</b>.
* @param path The PathName object you want to investigate.
- */
+ */
void setPath( const PathName & path );
/**
- * @brief Set the [l]stat mode to <b>mode</b>.
+ * @brief Set the [l]stat mode to <b>mode</b>.
*
* When examining a link you get:
* - information about the link itself, when you are in lstat mode
* - information about the file the link points to, when you are in stat
* mode
*
- * @param mode The mode you want to set. Can be PathInfo::E_STAT, or
+ * @param mode The mode you want to set. Can be PathInfo::E_STAT, or
* PathInfo::E_LSTAT
* @see Mode
*/
@@ -250,24 +250,24 @@
* In case stat fails errno is saved and can be acquired with
* PathInfo::error(). The stat mode remains set to 'E_STAT'.
*
- * @param path The PathName object pointing to the path you want to
+ * @param path The PathName object pointing to the path you want to
* investigate.
*
- * @return True on success, false if stat fails.
+ * @return True on success, false if stat fails.
*
*/
bool stat ( const PathName & path );
/**
- * @brief Performs lstat on path.
+ * @brief Performs lstat on path.
*
* In case lstat fails errno is saved and can be acquired with
* PathInfo::error(). The stat mode remains set to 'E_LSTAT'.
*
- * @param path A PathName object pointing to the path you want to
+ * @param path A PathName object pointing to the path you want to
* investigate.
*
- * @return True on success, false if lstat fails.
+ * @return True on success, false if lstat fails.
*
*/
bool lstat ( const PathName & path );
@@ -275,13 +275,13 @@
/**
* @brief Sets the PathInfo object to <b>path</b> and performs (l)stat on
- * on it.
- *
- * Which function is called depends on the current stat mode (default: E_STAT).
+ * on it.
+ *
+ * Which function is called depends on the current stat mode (default: E_STAT).
* On error errno is saved and can be acquired via PathInfo::error().
*
*
- * @param path A PathName object point to the path you want to
+ * @param path A PathName object point to the path you want to
* investigate.
*
* @return True on success, false if (l)stat fails.
@@ -292,21 +292,21 @@
/**
* @brief Performs a stat operation on the path currently held by this PathInfo
- * object.
+ * object.
*
- * On error errno is saved an can be acquired via PathInfo::error().
+ * On error errno is saved an can be acquired via PathInfo::error().
* The stat mode remains set to 'E_STAT'
*
* @return True on success, false if stat fails.
*
*/
bool stat();
-
+
/**
* @brief Performs a lstat operation on the path currently held by this PathInfo
* object.
*
- * On error errno is saved an can be acquired via PathInfo::error().
+ * On error errno is saved an can be acquired via PathInfo::error().
* The stat mode remains set to 'E_LSTAT'
*
* @return True on success, false if lstat fails.
@@ -315,9 +315,9 @@
bool lstat();
/**
- * @brief Performs (l)stat on current path.
+ * @brief Performs (l)stat on current path.
*
- * Depending on the current stat mode this operator performs either stat,
+ * Depending on the current stat mode this operator performs either stat,
* or lstat. On error errno is saved and can be acquired via PathInfo::error().
*
* @return True on success, false of (l)stat fails.
@@ -328,7 +328,7 @@
/**
- * @brief True if the path that this PathInfo object points to exists.
+ * @brief True if the path that this PathInfo object points to exists.
*
*
* @return True if path exists.
@@ -339,48 +339,48 @@
/**
* @name File type functions.
*/
- // @{
+ // @{
/**
* @brief Returns the file type.
*
- * @return The file type.
+ * @return The file type.
* @see FileType
- */
+ */
FileType fileType() const;
/**
- * @brief Check if the PathInfo object points to a regular file.
+ * @brief Check if the PathInfo object points to a regular file.
*/
bool isFile() const;
-
+
/**
- * @brief Check if the PathInfo object points to a directory.
+ * @brief Check if the PathInfo object points to a directory.
*/
bool isDir () const;
-
+
/**
- * @brief Check if the PathInfo object points to a symbolic %link.
+ * @brief Check if the PathInfo object points to a symbolic %link.
*/
bool isLink() const;
-
+
/**
- * @brief Check if the PathInfo object points to a character device.
+ * @brief Check if the PathInfo object points to a character device.
*/
bool isChr() const;
-
+
/**
- * @brief Check if the PathInfo object points to a block device.
+ * @brief Check if the PathInfo object points to a block device.
*/
bool isBlk() const;
-
+
/**
- * @brief Check if the PathInfo object points to a FIFO (named pipe).
+ * @brief Check if the PathInfo object points to a FIFO (named pipe).
*/
bool isFifo() const;
-
+
/**
- * @brief Check if the PathInfo object points to a socket.
+ * @brief Check if the PathInfo object points to a socket.
*/
bool isSock() const;
@@ -388,14 +388,14 @@
/**
* @brief Returns the number of hard links to the file the PathName object
- * points to.
+ * points to.
*
* @return Number of hard links to the file.
*/
nlink_t nlink() const;
/**
- * @brief Get the user ID of the file owner.
+ * @brief Get the user ID of the file owner.
*
*
* @return Uid of file owner.
@@ -404,10 +404,10 @@
uid_t owner() const;
/**
- * @brief Get the group ID of the file owner.
+ * @brief Get the group ID of the file owner.
*
*
- * @return Gid of file owner.
+ * @return Gid of file owner.
*
*/
gid_t group() const;
@@ -416,8 +416,8 @@
* @name Permissions
*
* The following functions can be used to check for file permissions.
- * Their functionality closely resembles the POSIX flags
- * mentioned in 'man [l]stat'.
+ * Their functionality closely resembles the POSIX flags
+ * mentioned in 'man [l]stat'.
*/
// @{
/** @brief Check if owner has read permission. */
@@ -426,7 +426,7 @@
bool isWUsr() const;
/** @brief Check if owner has execute permission. */
bool isXUsr() const;
-
+
/** @see isRUsr() */
bool isR() const;
/** @see isWUsr() */
@@ -456,23 +456,23 @@
bool isVtx() const;
/** @brief Get the file owner permissions.
- *
+ *
* All other flags are masked out (masked to 0).
*
* @return The masked mode_t.
*/
mode_t uperm() const;
-
+
/** @brief Get the file group permissions.
- *
+ *
* All other flags are masked out (masked to 0).
*
* @return The masked mode_t.
*/
mode_t gperm() const;
-
+
/** @brief Get the file permissions for others.
- *
+ *
* All other flags are masked out (masked to 0).
*
* @return The masked mode_t.
@@ -496,7 +496,7 @@
*
*/
bool isPerm ( mode_t m ) const;
-
+
/**
* @brief Check if file has given permission flags set.
*
@@ -511,7 +511,7 @@
/**
* @brief Returns the mode (i.e. file access permissions) of the file.
*
- * From the lstat man page:
+ * From the lstat man page:
* The following POSIX macros are defined to check the file type:
* - S_ISREG(mode_t) is it a regular file?
* - S_ISDIR(mode_t) directory?
@@ -521,12 +521,12 @@
* - S_ISLNK(mode_t) symbolic link? (Not in POSIX.1-1996.)
* - S_ISSOCK(mode_t) socket? (Not in POSIX.1-1996.)
*
- * @return The access permissions of the file.
+ * @return The access permissions of the file.
*/
mode_t st_mode() const;
/**
- * @brief Get permission according to current uid/gid
+ * @brief Get permission according to current uid/gid
*
* @return The current users' permissions on the file [0-7].
*/
@@ -534,65 +534,65 @@
/**
- * @brief Check if the current User (as returned by getuid()) may read the file.
+ * @brief Check if the current User (as returned by getuid()) may read the file.
*
- * @return True if current user has read permissions.
+ * @return True if current user has read permissions.
*
*/
bool userMayR() const;
-
+
/**
- * @brief Check if the current User (as returned by getuid()) may write to the file.
+ * @brief Check if the current User (as returned by getuid()) may write to the file.
*
- * @return True if current user has write permissions.
+ * @return True if current user has write permissions.
*
*/
bool userMayW() const;
-
+
/**
- * @brief Check if the current User (as returned by getuid()) may execute the file.
+ * @brief Check if the current User (as returned by getuid()) may execute the file.
*
- * @return True if current user has execute permissions.
+ * @return True if current user has execute permissions.
*
*/
bool userMayX() const;
/**
* @brief Check if the current User (as returned by getuid()) may read and write
- * the file.
+ * the file.
*
- * @return True if current user has read and write permissions.
+ * @return True if current user has read and write permissions.
*
*/
bool userMayRW() const;
-
+
/**
* @brief Check if the current User (as returned by getuid()) may read and execute
- * the file.
+ * the file.
*
- * @return True if current user has read and execute permissions.
+ * @return True if current user has read and execute permissions.
*
*/
bool userMayRX() const;
-
+
/**
- * @brief Check if the current User (as returned by getuid()) may write and execute
- * the file.
+ * @brief Check if the current User (as returned by getuid()) may write and execute
+ * the file.
*
- * @return True if current user has write and execute permissions.
+ * @return True if current user has write and execute permissions.
*
*/
bool userMayWX() const;
/**
- * @brief Check if the current User (as returned by getuid()) may read, write and
- * execute the file.
+ * @brief Check if the current User (as returned by getuid()) may read, write and
+ * execute the file.
*
- * @return True if current user has read, write and execute permissions.
+ * @return True if current user has read, write and execute permissions.
*
*/
bool userMayRWX() const;
-
+
// @}
// device
@@ -600,20 +600,20 @@
/**
* @brief Returns the ID of the device that contains the file.
*
- * @return The device id that contains the file.
+ * @return The device id that contains the file.
*/
dev_t dev() const;
/**
* @brief Returns the device ID of a special file.
*
- * @return The device ID of the file (in case of a special file).
+ * @return The device ID of the file (in case of a special file).
*/
dev_t rdev() const;
/**
* @brief Returns the inode number of the file or directory this PathInfo
- * object holds.
+ * object holds.
*
* @return The inode number.
*/
@@ -643,7 +643,7 @@
/**
* @brief Returns the number of blocks used by the file.
*
- * @return The number of blocks used by the file.
+ * @return The number of blocks used by the file.
*
*/
blkcnt_t blocks() const;
@@ -654,21 +654,21 @@
* @brief Get the access time of the file.
*
* @return The access time as a UNIX time stamp.
- */
+ */
time_t atime() const; /* time of last access */
-
+
/**
- * @brief Get the time of the last modification of the file.
+ * @brief Get the time of the last modification of the file.
*
* @return The modification time as a UNIX time stamp.
- */
+ */
time_t mtime() const; /* time of last modification */
-
+
/**
- * @brief Get the last-change time of inode status of the file.
+ * @brief Get the last-change time of inode status of the file.
*
* @return The last-change time as a UNIX time stamp.
- */
+ */
time_t ctime() const;
// @}
@@ -678,7 +678,7 @@
/**
* @class PathInfo::StatMode
- *
+ *
* @brief Wrapper class for mode_t values as derived from ::stat
*/
class PathInfo::StatMode {
@@ -690,10 +690,10 @@
public:
StatMode( const mode_t & mode_r = 0 ) : _mode( mode_r ) {}
- /**
- * @name file type wrapper functions
+ /**
+ * @name file type wrapper functions
*
- * For a more detailed description of these functions see the corresponding
+ * For a more detailed description of these functions see the corresponding
* PathInfo (don't know why doxy-gen doesn't create a %link to the PathInfo doc here)
* functions.
*/
@@ -708,7 +708,7 @@
bool isFifo() const;
bool isSock() const;
// @}
-
+
/** @name file permission wrapper functions */
// @{
bool isRUsr() const;
@@ -778,10 +778,10 @@
void clear() { _devino.clear(); }
/**
- * @brief Remember dev/ino.
+ * @brief Remember dev/ino.
*
- * @return
- * - <code>true</code> if it's inserted the first time
+ * @return
+ * - <code>true</code> if it's inserted the first time
* - <code>false</code> if already present in cache (a hard link to a
* previously remembered file.
**/
Modified: limal-branches/mc-devel/limal-ca-mgm/src/limal/PathName.hpp
URL: http://svn.opensuse.org/viewcvs/limal/limal-branches/mc-devel/limal-ca-mgm/src/limal/PathName.hpp?rev=2697&r1=2696&r2=2697&view=diff
==============================================================================
--- limal-branches/mc-devel/limal-ca-mgm/src/limal/PathName.hpp (original)
+++ limal-branches/mc-devel/limal-ca-mgm/src/limal/PathName.hpp Fri Aug 13 17:53:26 2010
@@ -45,6 +45,8 @@
#include <list>
#include <iosfwd>
+#define FILENAME_SEPARATOR "/"
+#define FILENAME_SEPARATOR_C '/'
// -------------------------------------------------------------------
namespace LIMAL_NAMESPACE
@@ -131,6 +133,7 @@
* @return The complete path this PathName object holds.
*/
std::string toString() const;
+ std::string asString() const { return toString(); }
/**
* @brief Returns the path this PathName object holds, as
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=2697&r1=2696&r2=2697&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 Fri Aug 13 17:53:26 2010
@@ -1,14 +1,14 @@
-d12f85f32848ae7f9f1d8064813aaa53-1281703849 /C=DE/CN=Test CA\/SUSE Inc.\\\\Gmbh/emailAddress=suse@suse.de
-68b3a1b7290aadfd42361b1b3c14e69a-1281703851 /C=DE/CN=Test Server Certificate\/SUSE Inc.\\\\Gmbh/emailAddress=suse@suse.de
-40717a16174dc4d516f6fa7ee8eeb18c-1281703857 /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
-40717a16174dc4d516f6fa7ee8eeb18c-1281703860 /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
-40717a16174dc4d516f6fa7ee8eeb18c-1281703864 /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
-d12f85f32848ae7f9f1d8064813aaa53-1281703874 /C=DE/CN=Test CA\/SUSE Inc.\\\\Gmbh/emailAddress=suse@suse.de
-c293624b6a877f401407ce8f8f1f327e-1281703875 /C=DE/L=Nuremberg/O=SUSE Linux GmbH/OU=IT/CN=SUSE User CA/emailAddress=security-team@suse.de
-d12f85f32848ae7f9f1d8064813aaa53-1281703876 /C=DE/CN=Test CA\/SUSE Inc.\\\\Gmbh/emailAddress=suse@suse.de
-c1943ae4b9bd7320fae3e29f217483e3-1281703877 /C=DE/CN=Test Request/emailAddress=suse@suse.de
-d816690a832b0e52becd255d3a62e975-1281703881 /C=DE/CN=Test Certificate for revocation 2/emailAddress=suse@suse.de
-9198f6798d9da70d7cbfb67b610633f5-1281703883 /C=DE/CN=Test Certificate for revocation 3/emailAddress=suse@suse.de
-3e248858337c2b46dc67a0f9389376dd-1281703884 /C=DE/CN=Test Certificate for revocation 4/emailAddress=suse@suse.de
-bf04fdd95062554800c1556085f47063-1281703887 /C=DE/CN=Test Certificate for revocation 5 oid test/emailAddress=suse@suse.de
-9797ac11af29f94b82c1e5b0499ab5f2-1281703891 /C=DE/CN=Test Sub CA/emailAddress=suse@suse.de
+d12f85f32848ae7f9f1d8064813aaa53-1281714593 /C=DE/CN=Test CA\/SUSE Inc.\\\\Gmbh/emailAddress=suse@suse.de
+68b3a1b7290aadfd42361b1b3c14e69a-1281714594 /C=DE/CN=Test Server Certificate\/SUSE Inc.\\\\Gmbh/emailAddress=suse@suse.de
+40717a16174dc4d516f6fa7ee8eeb18c-1281714599 /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
+40717a16174dc4d516f6fa7ee8eeb18c-1281714601 /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
+40717a16174dc4d516f6fa7ee8eeb18c-1281714605 /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
+d12f85f32848ae7f9f1d8064813aaa53-1281714610 /C=DE/CN=Test CA\/SUSE Inc.\\\\Gmbh/emailAddress=suse@suse.de
+c293624b6a877f401407ce8f8f1f327e-1281714611 /C=DE/L=Nuremberg/O=SUSE Linux GmbH/OU=IT/CN=SUSE User CA/emailAddress=security-team@suse.de
+d12f85f32848ae7f9f1d8064813aaa53-1281714612 /C=DE/CN=Test CA\/SUSE Inc.\\\\Gmbh/emailAddress=suse@suse.de
+c1943ae4b9bd7320fae3e29f217483e3-1281714612 /C=DE/CN=Test Request/emailAddress=suse@suse.de
+d816690a832b0e52becd255d3a62e975-1281714615 /C=DE/CN=Test Certificate for revocation 2/emailAddress=suse@suse.de
+9198f6798d9da70d7cbfb67b610633f5-1281714615 /C=DE/CN=Test Certificate for revocation 3/emailAddress=suse@suse.de
+3e248858337c2b46dc67a0f9389376dd-1281714616 /C=DE/CN=Test Certificate for revocation 4/emailAddress=suse@suse.de
+bf04fdd95062554800c1556085f47063-1281714618 /C=DE/CN=Test Certificate for revocation 5 oid test/emailAddress=suse@suse.de
+9797ac11af29f94b82c1e5b0499ab5f2-1281714621 /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=2697&r1=2696&r2=2697&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 Fri Aug 13 17:53:26 2010
@@ -1,11 +1,11 @@
-V 110813125050Z 01 unknown /C=DE/CN=Test CA/SUSE Inc.Gmbh/emailAddress=suse@suse.de
-V 110813125051Z 02 unknown /C=DE/CN=Test Server Certificate/SUSE Inc.Gmbh/emailAddress=suse@suse.de
-V 110813125055Z 03 unknown /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
-V 110813125058Z 04 unknown /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
-V 110813125102Z 05 unknown /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
-R 110813125118Z 100813125121Z 06 unknown /C=DE/CN=Test Certificate for revocation/emailAddress=suse@suse.de
-R 110813125121Z 100813125123Z,holdInstruction,holdInstructionCallIssuer 07 unknown /C=DE/CN=Test Certificate for revocation 2/emailAddress=suse@suse.de
-R 110813125123Z 100813125124Z,keyTime,20100813123444Z 08 unknown /C=DE/CN=Test Certificate for revocation 3/emailAddress=suse@suse.de
-R 110813125124Z 100813125127Z,CAkeyTime,20100813123447Z 09 unknown /C=DE/CN=Test Certificate for revocation 4/emailAddress=suse@suse.de
-R 110813125127Z 100813125130Z,holdInstruction,1.6.21.43 0A unknown /C=DE/CN=Test Certificate for revocation 5 oid test/emailAddress=suse@suse.de
-V 120812125131Z 0B unknown /C=DE/CN=Test Sub CA/emailAddress=suse@suse.de
+V 110813154954Z 01 unknown /C=DE/CN=Test CA/SUSE Inc.Gmbh/emailAddress=suse@suse.de
+V 110813154954Z 02 unknown /C=DE/CN=Test Server Certificate/SUSE Inc.Gmbh/emailAddress=suse@suse.de
+V 110813154957Z 03 unknown /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
+V 110813154959Z 04 unknown /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
+V 110813155003Z 05 unknown /C=DE/CN=Full Test Certificate/emailAddress=suse@suse.de
+R 110813155013Z 100813155014Z 06 unknown /C=DE/CN=Test Certificate for revocation/emailAddress=suse@suse.de
+R 110813155015Z 100813155015Z,holdInstruction,holdInstructionCallIssuer 07 unknown /C=DE/CN=Test Certificate for revocation 2/emailAddress=suse@suse.de
+R 110813155015Z 100813155016Z,keyTime,20100813153336Z 08 unknown /C=DE/CN=Test Certificate for revocation 3/emailAddress=suse@suse.de
+R 110813155016Z 100813155018Z,CAkeyTime,20100813153338Z 09 unknown /C=DE/CN=Test Certificate for revocation 4/emailAddress=suse@suse.de
+R 110813155018Z 100813155021Z,holdInstruction,1.6.21.43 0A unknown /C=DE/CN=Test Certificate for revocation 5 oid test/emailAddress=suse@suse.de
+V 120812155021Z 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=2697&r1=2696&r2=2697&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=2697&r1=2696&r2=2697&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 Fri Aug 13 17:53:26 2010
@@ -1,7 +1,7 @@
-----BEGIN X509 CRL-----
MIIC+TCCAeECAQEwDQYJKoZIhvcNAQEFBQAwQzELMAkGA1UEBhMCREUxFzAVBgNV
BAMTDlN0YXRpYyBUZXN0IENBMRswGQYJKoZIhvcNAQkBFgxzdXNlQHN1c2UuZGUX
-DTEwMDgxMzEyNTEzM1oXDTEwMDgxNDEyNTEzM1owgfAwEgIBAxcNMDUwODE4MTQx
+DTEwMDgxMzE1NTAyM1oXDTEwMDgxNDE1NTAyM1owgfAwEgIBAxcNMDUwODE4MTQx
MzIzWjAyAgEEFw0wNTA4MTgxNDEzMjVaMB4wCgYDVR0VBAMKAQYwEAYDVR0XBAkG
ByqGSM44AgIwOgIBBRcNMDUwODE4MTQxMzI2WjAmMAoGA1UdFQQDCgEBMBgGA1Ud
GAQRGA8yMDA1MDgxODE1NTY0NlowOgIBBhcNMDUwODE4MTQxMzI4WjAmMAoGA1Ud
@@ -9,10 +9,10 @@
ODE4WjAaMAoGA1UdFQQDCgEGMAwGA1UdFwQFBgMuFSugdzB1MHMGA1UdIwRsMGqA
FDIAwASkKojCPsrVvdhM01KIIH87oUekRTBDMQswCQYDVQQGEwJERTEXMBUGA1UE
AxMOU3RhdGljIFRlc3QgQ0ExGzAZBgkqhkiG9w0BCQEWDHN1c2VAc3VzZS5kZYIJ
-AI7xzphhj2SdMA0GCSqGSIb3DQEBBQUAA4IBAQBZRDFdegYDlJXia9yz7Gz732/6
-Ht/nm2j2Vw0Hk1In334Lq2c3+qd1TB27S5dIvywCQAGq2FxC0jgcVgzSI6h9FbSI
-ETjhqHpbyrgA6NGfWBH9OcyRRx4E1NhwmlUBTwdbXKF7uAmrkI0sfOr8CEYvXdPy
-g24J3K4yQV8SwP7GNDlnIotEXPHX/krlomH/kFirF1zSxahohGEkqMb9rgiWafxy
-oRVzkP+h7huFkmcKpQef0D+yrxauDn7Pq5r4jWu7E0XnZA2zT+p+eylIZfKtydy3
-QImyRE/pVcUe4Dt2pYwSbeQwUa1XL/brJVOggqypWEl3KDNCXwmH7mL9H0zK
+AI7xzphhj2SdMA0GCSqGSIb3DQEBBQUAA4IBAQCF5Cc4wP6NPVMXaNUpysmGfMv2
+p7n+cgzADabrwFzmMubExvXaKreHYsWF2TjyunpnwhtNm0G5+09yrOEb+qOgoeoX
+KI2is5CuDHGmguC+GO023HAKFQn8B9Dx6L4rXWjbnSegLeieIGDfDpO8/LpCTPt0
+Nhxe0OeceVFRQn9kBteqds4Jtp6/8UrBtnk5rF/KOxaA9wBpGc2q4crdMSMBO0mI
+UdiJmIisQ10W8K0f9E6H+6Ptxdq/eZUPiTDk8KeR7nS7ej6cclDNx8nn/utrP+8G
+Ccyb5H+a0aOq0SGcPVv/pToEgnhnLbepKUPAcwjxPzWEdoSR/amBgn5pe9NZ
-----END X509 CRL-----
--
To unsubscribe, e-mail: limal-commit+unsubscribe@opensuse.org
For additional commands, e-mail: limal-commit+help@opensuse.org