From 7f78288cb0dbd1ba16fc52944d72bb4e5d8f0bdb Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Wed, 2 Apr 2008 15:05:51 +0000 Subject: [PATCH] Add call to get GlobalSettings from daemon/service. --- CASA/gui/CommonGUI.cs | 36 +++++++++++++++---- .../lib/communication/MiCasaRequestReply.cs | 3 +- CASA/micasad/verbs/ObjectSerialization.cs | 22 +++++++++--- 3 files changed, 49 insertions(+), 12 deletions(-) diff --git a/CASA/gui/CommonGUI.cs b/CASA/gui/CommonGUI.cs index 02420a22..bb069be7 100644 --- a/CASA/gui/CommonGUI.cs +++ b/CASA/gui/CommonGUI.cs @@ -71,6 +71,7 @@ namespace Novell.CASA.GUI // } + /// /// HandleUnlock dialog /// @@ -406,17 +407,38 @@ namespace Novell.CASA.GUI } } - internal static bool UseMasterPassword() { -#if W32 - return IsRegKeySet(CASA_REG_KEY, "UseMasterPassword"); -#else - return true; -#endif + string sSettingValue; + sSettingValue = GetGlobalConfSetting("UseMasterPassword", "false"); + if (sSettingValue.Equals("true")) + { + return true; + } + else + { + return false; + } + } + + internal static string GetGlobalConfSetting(string sSettingName, string sDefaultValue) + { + string sSettingValue = null; + + if (sSettingName != null) + { + sSettingValue = (string)MiCasaRequestReply.Send(MiCasaRequestReply.VERB_GET_GLOBAL_SETTING, null, null, null, sSettingName); + } + + if ((sSettingValue == null) && (sDefaultValue != null)) + { + sSettingValue = sDefaultValue; + } + + return sSettingValue; } - + #if W32 private static bool IsRegKeySet(string sPath, string sValue) diff --git a/CASA/micasad/lib/communication/MiCasaRequestReply.cs b/CASA/micasad/lib/communication/MiCasaRequestReply.cs index c15162ff..26bfcd88 100644 --- a/CASA/micasad/lib/communication/MiCasaRequestReply.cs +++ b/CASA/micasad/lib/communication/MiCasaRequestReply.cs @@ -61,7 +61,8 @@ namespace Novell.CASA.MiCasa.Communication public const int VERB_CHANGE_PERSIST_DIR = 23; public const int VERB_CREATE_POLICY_DIR = 24; public const int VERB_GET_CREATE_TIME = 25; - public const int VERB_GET_MODIFIED_TIME = 26; + public const int VERB_GET_MODIFIED_TIME = 26; + public const int VERB_GET_GLOBAL_SETTING = 27; public const int VERB_DUMP_LINKED_KEYS = 96; public const int VERB_CREATE_TEST_SECRETS = 97; diff --git a/CASA/micasad/verbs/ObjectSerialization.cs b/CASA/micasad/verbs/ObjectSerialization.cs index 480dceca..65a491e4 100644 --- a/CASA/micasad/verbs/ObjectSerialization.cs +++ b/CASA/micasad/verbs/ObjectSerialization.cs @@ -242,9 +242,12 @@ namespace sscs.verbs case MiCasaRequestReply.VERB_GET_MODIFIED_TIME: { return DoGetModifiedTime(ssStore, wo); + } + case MiCasaRequestReply.VERB_GET_GLOBAL_SETTING: + { + return DoGetGlobalSetting(ssStore, wo); } - - + default: { wo.SetError(constants.RetCodes.FAILURE, "Verb Not Supported"); @@ -262,8 +265,19 @@ namespace sscs.verbs } return wo; - } - + } + + private WrappedObject DoGetGlobalSetting(SecretStore ssStore, WrappedObject wo) + { + String sSettingName = (string)wo.GetObject(); + String sSettingValue = null; + if (sSettingName != null) + { + sSettingValue = Config.GetGlobalConfigSetting(sSettingName); + } + wo.SetObject(sSettingValue); + return wo; + } private WrappedObject DoGetModifiedTime(SecretStore ssStore, WrappedObject wo) {