[Spice-commits] 5 commits - client/application.cpp client/cmd_line_parser.cpp client/cmd_line_parser.h client/controller.cpp common/draw.h
Christophe Fergau
teuf at kemper.freedesktop.org
Mon Apr 18 07:44:55 PDT 2011
client/application.cpp | 19 +++++++++++++++++--
client/cmd_line_parser.cpp | 10 +++++-----
client/cmd_line_parser.h | 6 +++---
client/controller.cpp | 2 +-
common/draw.h | 1 -
5 files changed, 26 insertions(+), 12 deletions(-)
New commits:
commit 12f99d327f6aeb92dc70356a9dddc67861c8d157
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Mon Apr 18 12:31:37 2011 +0200
client: skip spaces in --host-subject
This fixes fdo bug #32896:
"Subject in certificates is stored in following format (values separated by
comma and space):
grep Subject: server-cert.pem | awk -F": " '{print $2}'
O=REDHAT, CN=10.34.58.2
While spicec expects that values in host subject are separated only by comma:
spicec --host-subject "O=REDHAT,CN=10.34.58.2"
"
In this case, ignoring spaces make it much easier to directly copy and paste
the subject line from certificates.
diff --git a/client/application.cpp b/client/application.cpp
index ef08087..292dae6 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -2001,7 +2001,14 @@ bool Application::set_host_cert_subject(const char* subject, const char* arg0)
_exit_code = SPICEC_ERROR_CODE_INVALID_ARG;
return false;
}
- entry_pair.first = entry.substr(0, value_pos);
+ size_t start_pos = entry.find_first_not_of(' ');
+ if ((start_pos == std::string::npos) || (start_pos == value_pos)) {
+ Platform::term_printf("%s: host_subject bad format: first part of assignment must be non empty in %s\n",
+ arg0, entry.c_str());
+ _exit_code = SPICEC_ERROR_CODE_INVALID_ARG;
+ return false;
+ }
+ entry_pair.first = entry.substr(start_pos, value_pos - start_pos);
entry_pair.second = entry.substr(value_pos + 1);
_host_auth_opt.host_subject.push_back(entry_pair);
DBG(0, "subject entry: %s=%s", entry_pair.first.c_str(), entry_pair.second.c_str());
commit c2dbb45a20e1104e90048f82aff61a88c375c163
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Fri Apr 15 13:55:55 2011 +0200
draw: remove SPICE_ADDRESS
This commit removes the typedef for SPICE_ADDRESS which was no
longer used. This is the last thing that was missing to close
fdo bug #28984
diff --git a/common/draw.h b/common/draw.h
index 95f07b8..cb15672 100644
--- a/common/draw.h
+++ b/common/draw.h
@@ -39,7 +39,6 @@
#define SPICE_SET_ADDRESS(addr, val) ((addr) = (unsigned long)(val))
typedef int32_t SPICE_FIXED28_4;
-typedef uint64_t SPICE_ADDRESS;
typedef struct SpicePointFix {
SPICE_FIXED28_4 x;
commit f73ab66cb89be1455b17475d8a0980ddf29f447a
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Thu Apr 14 18:12:26 2011 +0200
client: add --version cmdline option to spicec
This fixes freedesktop bug #33907
diff --git a/client/application.cpp b/client/application.cpp
index e74a871..ef08087 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -2183,7 +2183,8 @@ bool Application::process_cmd_line(int argc, char** argv, bool &full_screen)
DisplaySetting display_setting;
enum {
- SPICE_OPT_HOST = CmdLineParser::OPTION_FIRST_AVAILABLE,
+ SPICE_OPT_VERSION = CmdLineParser::OPTION_FIRST_AVAILABLE,
+ SPICE_OPT_HOST,
SPICE_OPT_PORT,
SPICE_OPT_SPORT,
SPICE_OPT_PASSWORD,
@@ -2224,6 +2225,7 @@ bool Application::process_cmd_line(int argc, char** argv, bool &full_screen)
CmdLineParser parser("Spice client", false);
+ parser.add(SPICE_OPT_VERSION, "version", "spice client version", false);
parser.add(SPICE_OPT_HOST, "host", "spice server address", "host", true, 'h');
parser.add(SPICE_OPT_PORT, "port", "spice server port", "port", true, 'p');
parser.add(SPICE_OPT_SPORT, "secure-port", "spice server secure port", "port", true, 's');
@@ -2286,6 +2288,12 @@ bool Application::process_cmd_line(int argc, char** argv, bool &full_screen)
int op;
while ((op = parser.get_option(&val)) != CmdLineParser::OPTION_DONE) {
switch (op) {
+ case SPICE_OPT_VERSION: {
+ std::ostringstream os;
+ os << argv[0] << " "<< PACKAGE_VERSION << std::endl;
+ Platform::term_printf(os.str().c_str());
+ return false;
+ }
case SPICE_OPT_HOST:
host = val;
break;
commit d590b48a466ca22dca91ee05c9d10a8feff1b31e
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Thu Apr 14 17:02:16 2011 +0200
client: s/reqired/required in CmdLineParser
diff --git a/client/cmd_line_parser.cpp b/client/cmd_line_parser.cpp
index 1aa5c96..ec00c3e 100644
--- a/client/cmd_line_parser.cpp
+++ b/client/cmd_line_parser.cpp
@@ -119,7 +119,7 @@ void CmdLineParser::add(int id, const std::string& name, const std::string& help
}
void CmdLineParser::add(int id, const std::string& name, const std::string& help,
- const std::string& arg_name, bool reqired_arg, char short_name)
+ const std::string& arg_name, bool required_arg, char short_name)
{
if (id < OPTION_FIRST_AVAILABLE) {
THROW("invalid id");
@@ -129,7 +129,7 @@ void CmdLineParser::add(int id, const std::string& name, const std::string& help
THROW("invalid arg name");
}
- add_private(id, name, short_name, reqired_arg ? REQUIRED_ARGUMENT : OPTIONAL_ARGUMENT, help,
+ add_private(id, name, short_name, required_arg ? REQUIRED_ARGUMENT : OPTIONAL_ARGUMENT, help,
arg_name);
}
@@ -156,7 +156,7 @@ void CmdLineParser::set_multi(int id, char seperator)
opt->seperator = seperator;
}
-void CmdLineParser::set_reqired(int id)
+void CmdLineParser::set_required(int id)
{
if (_argv) {
THROW("unexpected");
diff --git a/client/cmd_line_parser.h b/client/cmd_line_parser.h
index 6e6c6d5..37b5660 100644
--- a/client/cmd_line_parser.h
+++ b/client/cmd_line_parser.h
@@ -35,9 +35,9 @@ public:
char short_name = 0);
void add(int id, const std::string& name, const std::string& help,
- const std::string& arg_name, bool reqired_arg, char short_name = 0);
+ const std::string& arg_name, bool required_arg, char short_name = 0);
void set_multi(int id, char seperator);
- void set_reqired(int id);
+ void set_required(int id);
void begin(int argc, char** argv);
int get_option(char** val);
commit 56a4a05ae77d21978ba12fde08662833287ab5d1
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Thu Apr 14 16:54:18 2011 +0200
client: s/AVAILIBLE/AVAILABLE in CmdLineParser
It was mispelt in a CmdLineParser enum.
diff --git a/client/application.cpp b/client/application.cpp
index 9d395ee..e74a871 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -2183,7 +2183,7 @@ bool Application::process_cmd_line(int argc, char** argv, bool &full_screen)
DisplaySetting display_setting;
enum {
- SPICE_OPT_HOST = CmdLineParser::OPTION_FIRST_AVILABLE,
+ SPICE_OPT_HOST = CmdLineParser::OPTION_FIRST_AVAILABLE,
SPICE_OPT_PORT,
SPICE_OPT_SPORT,
SPICE_OPT_PASSWORD,
diff --git a/client/cmd_line_parser.cpp b/client/cmd_line_parser.cpp
index da4af05..1aa5c96 100644
--- a/client/cmd_line_parser.cpp
+++ b/client/cmd_line_parser.cpp
@@ -112,7 +112,7 @@ void CmdLineParser::add_private(int id, const std::string& name, char short_name
void CmdLineParser::add(int id, const std::string& name, const std::string& help, char short_name)
{
- if (id < OPTION_FIRST_AVILABLE) {
+ if (id < OPTION_FIRST_AVAILABLE) {
THROW("invalid id");
}
add_private(id, name, short_name, NO_ARGUMENT, help, "");
@@ -121,7 +121,7 @@ void CmdLineParser::add(int id, const std::string& name, const std::string& help
void CmdLineParser::add(int id, const std::string& name, const std::string& help,
const std::string& arg_name, bool reqired_arg, char short_name)
{
- if (id < OPTION_FIRST_AVILABLE) {
+ if (id < OPTION_FIRST_AVAILABLE) {
THROW("invalid id");
}
diff --git a/client/cmd_line_parser.h b/client/cmd_line_parser.h
index 0493df8..6e6c6d5 100644
--- a/client/cmd_line_parser.h
+++ b/client/cmd_line_parser.h
@@ -25,7 +25,7 @@ public:
OPTION_ERROR = -1,
OPTION_DONE = 0,
OPTION_HELP = 256,
- OPTION_FIRST_AVILABLE,
+ OPTION_FIRST_AVAILABLE,
};
CmdLineParser(std::string description, bool allow_positional_args);
diff --git a/client/controller.cpp b/client/controller.cpp
index 476d22e..e8d37e6 100644
--- a/client/controller.cpp
+++ b/client/controller.cpp
@@ -416,7 +416,7 @@ bool ControllerConnection::create_menu(char* resource)
bool ControllerConnection::set_multi_val(uint32_t op, char* multi_val)
{
CmdLineParser parser("", false);
- int id = CmdLineParser::OPTION_FIRST_AVILABLE;
+ int id = CmdLineParser::OPTION_FIRST_AVAILABLE;
char* argv[] = {NULL, (char*)"--set", multi_val};
char* val;
More information about the Spice-commits
mailing list