Added code so that the miCASA cache gets cleaned up for user casaatsd
when updating the realm information for the ATS.
This commit is contained in:
parent
953a013002
commit
d6b3aef35f
@ -541,6 +541,30 @@ 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, {
|
||||||
@ -589,16 +613,9 @@ global boolean Write() {
|
|||||||
if (exit != 0)
|
if (exit != 0)
|
||||||
y2error("Failed to set realm " + realmId);
|
y2error("Failed to set realm " + realmId);
|
||||||
|
|
||||||
// Obtain the uid of casaatsd
|
// Save Proxy User Credentials in miCASA if we have the uid of casaatsd
|
||||||
ret = (map) SCR::Execute(.target.bash_output, "id -u casaatsd");
|
if (uid != "")
|
||||||
exit = ret["exit"]:-1;
|
|
||||||
if (exit == 0)
|
|
||||||
{
|
{
|
||||||
string cmd_output = ret["stdout"]:"";
|
|
||||||
list<string> uidComponents = splitstring(cmd_output, "\n");
|
|
||||||
string uid = uidComponents[0]:"";
|
|
||||||
y2milestone("casaatsd uid = " + uid);
|
|
||||||
|
|
||||||
// Set the Proxy User Credentials in miCASA
|
// Set the Proxy User Credentials in miCASA
|
||||||
cmd = sformat("KEYVALUE=\"%1\" CASAcli -s -u %2 -n %3 -k CN", proxy_username, uid, realmId);
|
cmd = sformat("KEYVALUE=\"%1\" CASAcli -s -u %2 -n %3 -k CN", proxy_username, uid, realmId);
|
||||||
ret = (map) SCR::Execute(.target.bash_output, cmd);
|
ret = (map) SCR::Execute(.target.bash_output, cmd);
|
||||||
@ -614,7 +631,7 @@ global boolean Write() {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
y2error("Failed to obtain casaatsd uid");
|
y2error("Not setting proxy credentials in miCASA due to blank uid");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user