From 9c4ea3868bac524afa5079d30e452046ea1febea Mon Sep 17 00:00:00 2001 From: lsreevatsa Date: Tue, 7 Mar 2006 17:37:30 +0000 Subject: [PATCH] - Changed the GetDefaultWallet() function to address all scenarios. --- CASA.changes | 5 ++ c_adlib/ad_kw/native/kwallets_rw.cpp | 76 +++++++++++++--------------- 2 files changed, 40 insertions(+), 41 deletions(-) diff --git a/CASA.changes b/CASA.changes index 5e811906..d74049a3 100644 --- a/CASA.changes +++ b/CASA.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Mar 7 23:02:38 IST 2006 - lsreevatsa@novell.com + +- Changed the GetDefaultWallet() function to address all scenarios. + ------------------------------------------------------------------- Tue Mar 7 19:20:50 IST 2006 - smanojna@novell.com diff --git a/c_adlib/ad_kw/native/kwallets_rw.cpp b/c_adlib/ad_kw/native/kwallets_rw.cpp index 38dc300e..fe00ad45 100644 --- a/c_adlib/ad_kw/native/kwallets_rw.cpp +++ b/c_adlib/ad_kw/native/kwallets_rw.cpp @@ -27,6 +27,8 @@ #include #include +#define MAX_LENGTH 256 + using namespace KWallet; using namespace std; @@ -253,55 +255,45 @@ extern "C" } -void GetDefaultWallet(char dwallet[100]) + char * GetDefaultWallet() { - char *ptr = NULL; - char homedir[100]; - char defaultwallet[100]; - strcpy(homedir, getenv("HOME")); + char *homedir = getenv("HOME");; + char *defaultwallet = NULL; + defaultwallet = (char *)malloc(MAX_LENGTH); FILE *fs; - char str[100]; - int i; + char str[MAX_LENGTH]; + char *str1 = "Default Wallet="; + int i,j,k; //cout<<"kwallets_rw.cpp : Home Directory =" << homedir; strcat(homedir, "/.kde/share/config/kwalletrc"); + //cout << "\nkwallets_rw.cpp : Home directory full path = " << homedir; fs = fopen(homedir,"r"); - //fs = fopen("/root/.kde/share/config/kwalletrc","r"); if(!fs) { - strcpy(dwallet, "kdewallet"); - return; + return "kdewallet"; } - while(!feof(fs)) { - fgets(str,80,fs); - //cout<