- Fix for writing secrets into the default Wallet instead of

writing into CASAWallet.
- Changed the port attribute in Keyring from string to unit32.
This commit is contained in:
smanojna 2006-03-07 09:40:28 +00:00
parent d7ed360f66
commit 52f11fa9cd
3 changed files with 78 additions and 7 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Mar 7 15:08:26 IST 2006 - smanojna@novell.com
- Fix for writing secrets into the default Wallet instead of
writing into CASAWallet.
- Changed the port attribute in Keyring from string to unit32.
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Mar 6 16:30::00 IST 2006 - mmanohar@novell.com Mon Mar 6 16:30::00 IST 2006 - mmanohar@novell.com

View File

@ -631,8 +631,16 @@ CreateItemInKeyring(char *keyring, int32_t itemType, char *display_name, char *s
{ {
//printf("as.gk.c : CreateItemInKeyring : In key %s \n", attrs[i]->key); //printf("as.gk.c : CreateItemInKeyring : In key %s \n", attrs[i]->key);
attribute.name = g_strdup (attrs[i]->key); attribute.name = g_strdup (attrs[i]->key);
attribute.type = GNOME_KEYRING_ATTRIBUTE_TYPE_STRING; if( !strcmp(attrs[i]->key, "port"))
attribute.value.string = g_strdup (attrs[i]->value); {
attribute.type = GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32;
attribute.value.integer = atoi(attrs[i]->value);
}
else
{
attribute.type = GNOME_KEYRING_ATTRIBUTE_TYPE_STRING;
attribute.value.string = g_strdup(attrs[i]->value);
}
g_array_append_val (attributes, attribute); g_array_append_val (attributes, attribute);
} }
@ -908,8 +916,16 @@ SetItemAttributes (char *keyring, guint32 itemid, Attribute **attrs, int length)
{ {
//printf("ad_gk.c : In key %s \n", attrs[i]->key); //printf("ad_gk.c : In key %s \n", attrs[i]->key);
attribute.name = g_strdup (attrs[i]->key); attribute.name = g_strdup (attrs[i]->key);
attribute.type = GNOME_KEYRING_ATTRIBUTE_TYPE_STRING; if( !strcmp(attrs[i]->key, "port"))
attribute.value.string = g_strdup (attrs[i]->value); {
attribute.type = GNOME_KEYRING_ATTRIBUTE_TYPE_UINT32;
attribute.value.integer = atoi(attrs[i]->value);
}
else
{
attribute.type = GNOME_KEYRING_ATTRIBUTE_TYPE_STRING;
attribute.value.string = g_strdup(attrs[i]->value);
}
g_array_append_val (attributes, attribute); g_array_append_val (attributes, attribute);
} }
gnome_keyring_item_set_attributes (keyring, itemid, attributes, gnome_keyring_item_set_attributes (keyring, itemid, attributes,

View File

@ -25,9 +25,10 @@
#include <kcmdlineargs.h> #include <kcmdlineargs.h>
#include<kwallet.h> #include<kwallet.h>
#include <dcopclient.h> #include <dcopclient.h>
#include<iostream.h>
using namespace KWallet; using namespace KWallet;
using namespace std;
#include "kwallets_rw.h" #include "kwallets_rw.h"
#include "kwallets_rw.moc" #include "kwallets_rw.moc"
@ -252,6 +253,49 @@ extern "C"
} }
void GetDefaultWallet(char dwallet[100])
{
char *ptr = NULL;
char homedir[100];
char defaultwallet[100];
strcpy(homedir, getenv("HOME"));
FILE *fs;
char str[100];
int i;
//cout<<"kwallets_rw.cpp : Home Directory =" << homedir;
strcat(homedir, "/.kde/share/config/kwalletrc");
fs = fopen(homedir,"r");
//fs = fopen("/root/.kde/share/config/kwalletrc","r");
while(!feof(fs))
{
fgets(str,80,fs);
//cout<<str;
ptr = strstr(str,"Default Wallet");
//cout<<"got it";
if(ptr == NULL)
continue;
else
{
ptr = strchr(str,'=');
ptr++;
i=0;
while(*ptr != '\n')
{
//printf("%c",*ptr);
defaultwallet[i] = *ptr;
ptr++;
i++;
}
defaultwallet[i] = '\0';
break;
}
}
//return NULL;
//cout<<"Default Wallet : " << defaultwallet;
strcpy(dwallet,defaultwallet);
//return defaultwallet;
}
int RemoveEntry(char *name, char *foldername, char *keyname) int RemoveEntry(char *name, char *foldername, char *keyname)
{ {
@ -260,15 +304,19 @@ extern "C"
} }
int SetEntry(char *name, char *foldername, int entryType, char *keyname, char *value, int valueLen ) int SetEntry(char *name, char *foldername, int entryType, char *keyname, char *value, int valueLen )
{ {
char dwallet[100];
GetDefaultWallet(dwallet); //function called here
DCOPDemoWidget kw; DCOPDemoWidget kw;
//printf("kwallet : In Set Entry\n"); //printf("kwallet : In Set Entry\n");
return(kw.SetEntry(name,foldername,entryType,keyname,value,valueLen)); return(kw.SetEntry(dwallet,foldername,entryType,keyname,value,valueLen));
} }
int SetMapEntry(char *name, char *foldername, char *keyname, char **value, int eleCount ) int SetMapEntry(char *name, char *foldername, char *keyname, char **value, int eleCount )
{ {
char dwallet[100];
GetDefaultWallet(dwallet);//function called here
DCOPDemoWidget kw; DCOPDemoWidget kw;
//printf("kwallet: SetMapEntry\n"); //printf("kwallet: SetMapEntry\n");
return(kw.SetMap(name,foldername,keyname,value,eleCount)); return(kw.SetMap(dwallet,foldername,keyname,value,eleCount));
} }