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