164 lines
4.4 KiB
Diff
164 lines
4.4 KiB
Diff
|
--- gnome-session-2.15.91/gnome-session/Makefile.am
|
||
|
+++ gnome-session-2.15.91/gnome-session/Makefile.am
|
||
|
@@ -7,6 +7,7 @@
|
||
|
$(STANDARD_PROPERTIES_CFLAGS) \
|
||
|
$(WARN_CFLAGS) \
|
||
|
$(DISABLE_DEPRECATED_CFLAGS) \
|
||
|
+ -I/opt/novell/CASA/include \
|
||
|
-DGNOMELOCALEDIR=\""$(prefix)/${DATADIRNAME}/locale\"" \
|
||
|
-DGCONF_SANITY_CHECK=\""$(GCONF_SANITY_CHECK)"\" \
|
||
|
-DGNOME_KEYRING_DAEMON=\""$(GNOME_KEYRING_DAEMON)"\" \
|
||
|
--- gnome-session-2.15.91/gnome-session/main.c
|
||
|
+++ gnome-session-2.15.91/gnome-session/main.c
|
||
|
@@ -30,6 +30,10 @@
|
||
|
#include <netdb.h>
|
||
|
#include <time.h>
|
||
|
|
||
|
+/* added for CASA -- start */
|
||
|
+#include <dlfcn.h>
|
||
|
+/* added for CASA -- end */
|
||
|
+
|
||
|
#include <gconf/gconf-client.h>
|
||
|
|
||
|
#include <libgnome/libgnome.h>
|
||
|
@@ -37,6 +41,9 @@
|
||
|
|
||
|
#include <libgnomeui/gnome-window-icon.h>
|
||
|
|
||
|
+#include <gnome-keyring.h>
|
||
|
+#include <micasa_mgmd.h>
|
||
|
+
|
||
|
#include "manager.h"
|
||
|
#include "ice.h"
|
||
|
#include "save.h"
|
||
|
@@ -50,6 +57,19 @@
|
||
|
#include "gsm-at-startup.h"
|
||
|
#include "gsm-remote-desktop.h"
|
||
|
|
||
|
+
|
||
|
+/* added for CASA -- start */
|
||
|
+SSCS_TYPEDEF_LIBCALL(int, CASA_GetCredential_T)
|
||
|
+ (
|
||
|
+ uint32_t ssFlags,
|
||
|
+ SSCS_SECRET_ID_T * appSecretID,
|
||
|
+ SSCS_SECRET_ID_T * sharedSecretID,
|
||
|
+ uint32_t * credentialType,
|
||
|
+ void * credential,
|
||
|
+ SSCS_EXT_T * ext
|
||
|
+ );
|
||
|
+/* added for CASA -- end */
|
||
|
+
|
||
|
/* Flag indicating autosave - user won't be prompted on logout to
|
||
|
* save the session */
|
||
|
gboolean autosave = FALSE;
|
||
|
@@ -78,6 +98,8 @@
|
||
|
|
||
|
gchar *session_name = NULL;
|
||
|
|
||
|
+gchar *default_keyring = NULL;
|
||
|
+
|
||
|
static const GOptionEntry options[] = {
|
||
|
{"choose-session", '\0', 0, G_OPTION_ARG_STRING, &session_name, N_("Specify a session name to load"), N_("NAME")},
|
||
|
{"failsafe", '\0', 0, G_OPTION_ARG_NONE, &failsafe, N_("Only read saved sessions from the default.session file"), NULL},
|
||
|
@@ -321,6 +343,63 @@
|
||
|
return (tm->tm_year >= 105); /* We start on Jan 1 2006 */
|
||
|
}
|
||
|
|
||
|
+/* modified for CASA -- start */
|
||
|
+static gchar *
|
||
|
+get_casa_password (gboolean try_gnome_keyring)
|
||
|
+{
|
||
|
+ int rcode = 0;
|
||
|
+ int32_t credtype = SSCS_CRED_TYPE_BASIC_F;
|
||
|
+
|
||
|
+ void *casaIDK = NULL;
|
||
|
+
|
||
|
+ CASA_GetCredential_T p_miCASAGetCredential = NULL;
|
||
|
+
|
||
|
+
|
||
|
+ SSCS_BASIC_CREDENTIAL credential = { 0 };
|
||
|
+ SSCS_SECRET_ID_T appSecretId = { 0 };
|
||
|
+ SSCS_SECRET_ID_T sharedSecretId = { 0 };
|
||
|
+ SSCS_EXT_T ext = {0};
|
||
|
+
|
||
|
+ g_strlcpy (appSecretId.id, "Gnome_Keyring_Default", sizeof (appSecretId.id));
|
||
|
+ appSecretId.len = strlen (appSecretId.id) + 1;
|
||
|
+
|
||
|
+ g_strlcpy (sharedSecretId.id, "Desktop", sizeof (sharedSecretId.id));
|
||
|
+ sharedSecretId.len = strlen (sharedSecretId.id) + 1;
|
||
|
+
|
||
|
+ credential.unFlags = USERNAME_TYPE_CN_F;
|
||
|
+
|
||
|
+ if((casaIDK = dlopen("libmicasa.so.1", RTLD_LAZY)))
|
||
|
+ {
|
||
|
+ p_miCASAGetCredential = (CASA_GetCredential_T)dlsym(casaIDK, "miCASAGetCredential");
|
||
|
+ rcode = p_miCASAGetCredential (0,
|
||
|
+ try_gnome_keyring ? &appSecretId : NULL,
|
||
|
+ &sharedSecretId,
|
||
|
+ &credtype,
|
||
|
+ &credential,
|
||
|
+ NULL);
|
||
|
+
|
||
|
+ dlclose(casaIDK);
|
||
|
+ if (rcode == NSSCS_SUCCESS) {
|
||
|
+ gchar *password = g_strdup (credential.password);
|
||
|
+
|
||
|
+ memset (credential.password, 0, strlen (credential.password));
|
||
|
+ return password;
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ return NULL;
|
||
|
+}
|
||
|
+/* modified for CASA -- end */
|
||
|
+
|
||
|
+
|
||
|
+static void
|
||
|
+create_default_keyring (const gchar *password)
|
||
|
+{
|
||
|
+ gnome_keyring_create_sync ("default", password);
|
||
|
+ gnome_keyring_set_default_keyring_sync ("default");
|
||
|
+ default_keyring = g_strdup ("default");
|
||
|
+}
|
||
|
+
|
||
|
int
|
||
|
main (int argc, char *argv[])
|
||
|
{
|
||
|
@@ -492,6 +571,36 @@
|
||
|
|
||
|
gsm_remote_desktop_start ();
|
||
|
|
||
|
+ password = get_casa_password (TRUE);
|
||
|
+
|
||
|
+ if (password) {
|
||
|
+ GnomeKeyringResult result;
|
||
|
+
|
||
|
+ result = gnome_keyring_get_default_keyring_sync (&default_keyring);
|
||
|
+
|
||
|
+ if (result != GNOME_KEYRING_RESULT_OK || !default_keyring || !strlen (default_keyring))
|
||
|
+ create_default_keyring (password);
|
||
|
+
|
||
|
+ result = gnome_keyring_unlock_sync (default_keyring, password);
|
||
|
+
|
||
|
+ if (result == GNOME_KEYRING_RESULT_NO_SUCH_KEYRING) {
|
||
|
+ create_default_keyring (password);
|
||
|
+ gnome_keyring_unlock_sync (default_keyring, password);
|
||
|
+ }
|
||
|
+
|
||
|
+ if (result != GNOME_KEYRING_RESULT_OK) {
|
||
|
+ password = get_casa_password (FALSE);
|
||
|
+ if (password) {
|
||
|
+ gnome_keyring_unlock_sync (default_keyring, password);
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ if (password) {
|
||
|
+ memset (password, 0, strlen (password));
|
||
|
+ g_free (password);
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
if (splashing)
|
||
|
splash_start ();
|
||
|
|