Mailinglist Archive: yast-commit (864 mails)
| < Previous | Next > |
[yast-commit] r41818 - in /trunk/ca-management/src: YaPI/CaManagement.pm util.ycp
- From: mcalmer@xxxxxxxxxxxxxxxx
- Date: Tue, 06 Nov 2007 14:03:21 -0000
- Message-id: <20071106140321.64F6C26622@xxxxxxxxxxxxxxxx>
Author: mcalmer
Date: Tue Nov 6 15:03:20 2007
New Revision: 41818
URL: http://svn.opensuse.org/viewcvs/yast?rev=41818&view=rev
Log:
fix importCA
Modified:
trunk/ca-management/src/YaPI/CaManagement.pm
trunk/ca-management/src/util.ycp
Modified: trunk/ca-management/src/YaPI/CaManagement.pm
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ca-management/src/YaPI/CaManagement.pm?rev=41818&r1=41817&r2=41818&view=diff
==============================================================================
--- trunk/ca-management/src/YaPI/CaManagement.pm (original)
+++ trunk/ca-management/src/YaPI/CaManagement.pm Tue Nov 6 15:03:20 2007
@@ -6693,7 +6693,7 @@
* caKey (required - path to private key in PEM format)
-* caPasswd (required, if the private key is unencrypted)
+* caPasswd (required; password of the private key or a new password if the key
is unencrypted)
The return value is "undef" on an error and "1" on success.
@@ -6702,7 +6702,8 @@
my $data = {
caName => 'My_CA',
caCertificate => /path/to/cacert.pem,
- caKey => /path/to/cacert.key
+ caKey => /path/to/cacert.key,
+ caPasswd => "secret"
};
my $res = YaPI::CaManagement->ImportCA($data);
@@ -6750,23 +6751,24 @@
code => "FILE_DOES_NOT_EXIST");
}
+ if (!exists $data->{caPasswd} || !defined $data->{"caPasswd"} ) {
+ return $self->SetError( summary => __("Missing value 'caPasswd'."),
+ code => "CHECK_PARAM_FAILED");
+ }
+
eval {
my $cert =
LIMAL::CaMgm::LocalManagement::readFile($data->{caCertificate});
my $key = LIMAL::CaMgm::LocalManagement::readFile($data->{caKey});
- if(!exists $data->{caPasswd} || !defined $data->{caPasswd}) {
- $data->{caPasswd} = "";
- }
-
- if( defined $data->{'repository'}) {
-
+ if( defined $data->{'repository'})
+ {
LIMAL::CaMgm::CA::importCA($caName, $cert, $key,
$data->{caPasswd},
$data->{"repository"});
-
- } else {
-
+ }
+ else
+ {
LIMAL::CaMgm::CA::importCA($caName, $cert, $key,
$data->{caPasswd});
}
Modified: trunk/ca-management/src/util.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ca-management/src/util.ycp?rev=41818&r1=41817&r2=41818&view=diff
==============================================================================
--- trunk/ca-management/src/util.ycp (original)
+++ trunk/ca-management/src/util.ycp Tue Nov 6 15:03:20 2007
@@ -1318,6 +1318,7 @@
)
)
),
+ `Password( `id (`passKey), _("&Key
Password")),
`VSpacing (1),
`HBox ( // push button label
`PushButton (`id(`ok),
`opt(`default, `key_F10), Label::OKButton()),
@@ -1364,17 +1365,28 @@
string caCertificate = (string) UI::QueryWidget(`id(`pathCert),
`Value);
string caKey = (string) UI::QueryWidget(`id(`pathKey), `Value);
+ string caPasswd = (string) UI::QueryWidget(`id(`passKey),
`Value);
string caName = (string) UI::QueryWidget(`id(`caName), `Value);
if (size (caCertificate) == 0)
{
+ // Error popup
Popup::Error(_("Path to certificate file required."));
ret = `again;
} else if (size (caKey) == 0)
{
+ // Error popup
Popup::Error(_("Path of the private key required."));
ret = `again;
- } else if (size (caName) == 0)
+ }
+ else if (size (caPasswd) == 0)
{
+ // Error popup
+ Popup::Error(_("Key Password is required. \nIt must be
the password for the encrypted key or a new one in case of a not encrypted
key."));
+ ret = `again;
+ }
+ else if (size (caName) == 0)
+ {
+ // Error popup
Popup::Error(_("CA name required."));
ret = `again;
}
@@ -1385,37 +1397,26 @@
UI::OpenDialog(`VBox(`Label(_("Importing request..."))));
boolean yapiret = (boolean) YaPI::CaManagement::ImportCA
($["caName" : caName,
-
"caCertificate" : caCertificate,
-
"caKey" : caKey]);
- y2milestone ("ImportRequest(%1,%2,%3) return %4",
+
"caCertificate"
: caCertificate,
+
"caKey" : caKey,
+
"caPasswd" :
caPasswd
+
]);
+ y2milestone ("ImportRequest(%1,%2,%3, <passwd>) return %4",
caName,
caCertificate,
caKey,
yapiret);
- if (!yapiret)
- {
- // Checking if password required only
- map<string,any> messageMap = YaPI::Error();
- if (messageMap["code"]:"" == "PASSWD_REQUIRED")
- {
- yapiret = (boolean) YaPI::CaManagement::ImportCA
($["caName" : caName,
-
"caCertificate" : caCertificate,
-
"caKey" : caKey,
-
"caPasswd" : getPassword(caName)
-
]);
-
- }
- }
if (yapiret == nil)
{
- showErrorCaManagement ();
- ret = `again;
+ showErrorCaManagement ();
+ ret = `again;
}
else
{
- Popup::Message(_("Request has been imported."));
- success = true;
- }
+ // Error popup
+ Popup::Message(_("CA has been imported."));
+ success = true;
+ }
UI::CloseDialog ();
}
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
Date: Tue Nov 6 15:03:20 2007
New Revision: 41818
URL: http://svn.opensuse.org/viewcvs/yast?rev=41818&view=rev
Log:
fix importCA
Modified:
trunk/ca-management/src/YaPI/CaManagement.pm
trunk/ca-management/src/util.ycp
Modified: trunk/ca-management/src/YaPI/CaManagement.pm
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ca-management/src/YaPI/CaManagement.pm?rev=41818&r1=41817&r2=41818&view=diff
==============================================================================
--- trunk/ca-management/src/YaPI/CaManagement.pm (original)
+++ trunk/ca-management/src/YaPI/CaManagement.pm Tue Nov 6 15:03:20 2007
@@ -6693,7 +6693,7 @@
* caKey (required - path to private key in PEM format)
-* caPasswd (required, if the private key is unencrypted)
+* caPasswd (required; password of the private key or a new password if the key
is unencrypted)
The return value is "undef" on an error and "1" on success.
@@ -6702,7 +6702,8 @@
my $data = {
caName => 'My_CA',
caCertificate => /path/to/cacert.pem,
- caKey => /path/to/cacert.key
+ caKey => /path/to/cacert.key,
+ caPasswd => "secret"
};
my $res = YaPI::CaManagement->ImportCA($data);
@@ -6750,23 +6751,24 @@
code => "FILE_DOES_NOT_EXIST");
}
+ if (!exists $data->{caPasswd} || !defined $data->{"caPasswd"} ) {
+ return $self->SetError( summary => __("Missing value 'caPasswd'."),
+ code => "CHECK_PARAM_FAILED");
+ }
+
eval {
my $cert =
LIMAL::CaMgm::LocalManagement::readFile($data->{caCertificate});
my $key = LIMAL::CaMgm::LocalManagement::readFile($data->{caKey});
- if(!exists $data->{caPasswd} || !defined $data->{caPasswd}) {
- $data->{caPasswd} = "";
- }
-
- if( defined $data->{'repository'}) {
-
+ if( defined $data->{'repository'})
+ {
LIMAL::CaMgm::CA::importCA($caName, $cert, $key,
$data->{caPasswd},
$data->{"repository"});
-
- } else {
-
+ }
+ else
+ {
LIMAL::CaMgm::CA::importCA($caName, $cert, $key,
$data->{caPasswd});
}
Modified: trunk/ca-management/src/util.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ca-management/src/util.ycp?rev=41818&r1=41817&r2=41818&view=diff
==============================================================================
--- trunk/ca-management/src/util.ycp (original)
+++ trunk/ca-management/src/util.ycp Tue Nov 6 15:03:20 2007
@@ -1318,6 +1318,7 @@
)
)
),
+ `Password( `id (`passKey), _("&Key
Password")),
`VSpacing (1),
`HBox ( // push button label
`PushButton (`id(`ok),
`opt(`default, `key_F10), Label::OKButton()),
@@ -1364,17 +1365,28 @@
string caCertificate = (string) UI::QueryWidget(`id(`pathCert),
`Value);
string caKey = (string) UI::QueryWidget(`id(`pathKey), `Value);
+ string caPasswd = (string) UI::QueryWidget(`id(`passKey),
`Value);
string caName = (string) UI::QueryWidget(`id(`caName), `Value);
if (size (caCertificate) == 0)
{
+ // Error popup
Popup::Error(_("Path to certificate file required."));
ret = `again;
} else if (size (caKey) == 0)
{
+ // Error popup
Popup::Error(_("Path of the private key required."));
ret = `again;
- } else if (size (caName) == 0)
+ }
+ else if (size (caPasswd) == 0)
{
+ // Error popup
+ Popup::Error(_("Key Password is required. \nIt must be
the password for the encrypted key or a new one in case of a not encrypted
key."));
+ ret = `again;
+ }
+ else if (size (caName) == 0)
+ {
+ // Error popup
Popup::Error(_("CA name required."));
ret = `again;
}
@@ -1385,37 +1397,26 @@
UI::OpenDialog(`VBox(`Label(_("Importing request..."))));
boolean yapiret = (boolean) YaPI::CaManagement::ImportCA
($["caName" : caName,
-
"caCertificate" : caCertificate,
-
"caKey" : caKey]);
- y2milestone ("ImportRequest(%1,%2,%3) return %4",
+
"caCertificate"
: caCertificate,
+
"caKey" : caKey,
+
"caPasswd" :
caPasswd
+
]);
+ y2milestone ("ImportRequest(%1,%2,%3, <passwd>) return %4",
caName,
caCertificate,
caKey,
yapiret);
- if (!yapiret)
- {
- // Checking if password required only
- map<string,any> messageMap = YaPI::Error();
- if (messageMap["code"]:"" == "PASSWD_REQUIRED")
- {
- yapiret = (boolean) YaPI::CaManagement::ImportCA
($["caName" : caName,
-
"caCertificate" : caCertificate,
-
"caKey" : caKey,
-
"caPasswd" : getPassword(caName)
-
]);
-
- }
- }
if (yapiret == nil)
{
- showErrorCaManagement ();
- ret = `again;
+ showErrorCaManagement ();
+ ret = `again;
}
else
{
- Popup::Message(_("Request has been imported."));
- success = true;
- }
+ // Error popup
+ Popup::Message(_("CA has been imported."));
+ success = true;
+ }
UI::CloseDialog ();
}
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
| < Previous | Next > |