Changed so that Proxy Credentials be deleted when the ATS is disabled.

This commit is contained in:
Juan Carlos Luciani 2007-05-18 22:13:32 +00:00
parent d6b3aef35f
commit c559cc0ee1

View File

@ -481,15 +481,15 @@ global boolean Write() {
SCR::Execute(.target.bash, "/bin/cp "+trustedServerConfigFile+" "+trustedServerConfigFile+".YaST2save"); SCR::Execute(.target.bash, "/bin/cp "+trustedServerConfigFile+" "+trustedServerConfigFile+".YaST2save");
// Update the trusted server config // Update the trusted server config
any ret = false; any anyRet = false;
list<string> trustedServerList = Settings["CONFIG_CASAATS_TRUSTED"]:[]; list<string> trustedServerList = Settings["CONFIG_CASAATS_TRUSTED"]:[];
string trustedServerListString = ""; string trustedServerListString = "";
if (trustedServerList != []) { if (trustedServerList != []) {
// Merge all of the addresses onto the string // Merge all of the addresses onto the string
trustedServerListString = mergestring(trustedServerList, "\n"); trustedServerListString = mergestring(trustedServerList, "\n");
} }
ret = SCR::Write(.target.string, trustedServerConfigFile, trustedServerListString); anyRet = SCR::Write(.target.string, trustedServerConfigFile, trustedServerListString);
if (ret != true) if (anyRet != true)
y2error("Failed to write to " + trustedServerConfigFile); y2error("Failed to write to " + trustedServerConfigFile);
// Write the /etc/sysconfig/casa-ats settings // Write the /etc/sysconfig/casa-ats settings
@ -501,15 +501,35 @@ global boolean Write() {
if (false) Report::Error (_("Cannot sysconfig settings.")); if (false) Report::Error (_("Cannot sysconfig settings."));
sleep(sl); sleep(sl);
// Try to obtain the uid of casaatsd
string uid = "";
map ret = (map) SCR::Execute(.target.bash_output, "id -u casaatsd");
integer exit = ret["exit"]:-1;
if (exit == 0)
{
string cmd_output = ret["stdout"]:"";
list<string> uidComponents = splitstring(cmd_output, "\n");
uid = uidComponents[0]:"";
y2milestone("casaatsd uid = " + uid);
// Clear out the credentials that may have been saved in miCASA
// for this user.
string cmd = sformat("CASAcli -r -u %1", uid);
ret = (map) SCR::Execute(.target.bash_output, cmd);
exit = ret["exit"]:-1;
if (exit != 0)
y2error("Failed to remove casaatsd credentials");
}
// Check if we need to save the server configuration // Check if we need to save the server configuration
if ((Settings["CONFIG_CASAATS_ENABLE"]:false) == true) { if ((Settings["CONFIG_CASAATS_ENABLE"]:false) == true) {
// Create svc.settings file // Create svc.settings file
string cmd = "rm -f " + svcSettingsFile; string cmd = "rm -f " + svcSettingsFile;
map ret = (map) SCR::Execute(.target.bash_output, cmd); ret = (map) SCR::Execute(.target.bash_output, cmd);
cmd = svcSettingsEditor + " -create -file " + svcSettingsFile; cmd = svcSettingsEditor + " -create -file " + svcSettingsFile;
ret = (map) SCR::Execute(.target.bash_output, cmd); ret = (map) SCR::Execute(.target.bash_output, cmd);
integer exit = ret["exit"]:-1; exit = ret["exit"]:-1;
if (exit != 0) if (exit != 0)
y2error("Failed to create " + svcSettingsFile); y2error("Failed to create " + svcSettingsFile);
@ -541,30 +561,6 @@ global boolean Write() {
if (exit != 0) if (exit != 0)
y2error("Failed to create " + iaRealmsFile); y2error("Failed to create " + iaRealmsFile);
// Obtain the uid of casaatsd
string uid = "";
ret = (map) SCR::Execute(.target.bash_output, "id -u casaatsd");
exit = ret["exit"]:-1;
if (exit == 0)
{
string cmd_output = ret["stdout"]:"";
list<string> uidComponents = splitstring(cmd_output, "\n");
uid = uidComponents[0]:"";
y2milestone("casaatsd uid = " + uid);
// Clear out the credentials that may have been saved in miCASA
// for this user.
cmd = sformat("CASAcli -r -u %1", uid);
ret = (map) SCR::Execute(.target.bash_output, cmd);
exit = ret["exit"]:-1;
if (exit != 0)
y2error("Failed to remove casaatsd credentials");
}
else
{
y2error("Failed to obtain casaatsd uid");
}
// Add the real information to auth.policy and iaRealms.xml files // Add the real information to auth.policy and iaRealms.xml files
map<string, map> realms = (map<string, map>) CasaAts::Settings["CONFIG_CASAATS_REALMS"]:$[]; map<string, map> realms = (map<string, map>) CasaAts::Settings["CONFIG_CASAATS_REALMS"]:$[];
foreach (string key, map realm, realms, { foreach (string key, map realm, realms, {