- FIXED the Bug:140887-CASA displays KDE Wallet secrets in clear text in the
console. .............................................................................
This commit is contained in:
		| @@ -148,7 +148,7 @@ extern "C" | |||||||
| 	void Aggregate(struct EnumSecretList *enumWalletSecrets) | 	void Aggregate(struct EnumSecretList *enumWalletSecrets) | ||||||
| 	{ | 	{ | ||||||
|  |  | ||||||
|     printf("inside natiove agg"); |     //printf("inside natiove agg"); | ||||||
|          int retVal = 0; |          int retVal = 0; | ||||||
|          tempEnumSecrets = NULL; |          tempEnumSecrets = NULL; | ||||||
|          retVal = win->ReadAllWalletSecrets(&tempEnumSecrets); |          retVal = win->ReadAllWalletSecrets(&tempEnumSecrets); | ||||||
| @@ -219,13 +219,13 @@ 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 )  | ||||||
|         { |         { | ||||||
| 		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(name,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 )  | ||||||
|         { |         { | ||||||
| 		DCOPDemoWidget kw; | 		DCOPDemoWidget kw; | ||||||
|                 printf("kwallet: SetMapEntry\n"); |                 //printf("kwallet: SetMapEntry\n"); | ||||||
|          	return(kw.SetMap(name,foldername,keyname,value,eleCount));  |          	return(kw.SetMap(name,foldername,keyname,value,eleCount));  | ||||||
|         } |         } | ||||||
| 	 | 	 | ||||||
| @@ -278,7 +278,7 @@ extern "C" | |||||||
|  |  | ||||||
| 	                if (wallet == NULL) | 	                if (wallet == NULL) | ||||||
|         	        { |         	        { | ||||||
|                 	        printf("Could not open the wallet\n"); |                 	        //printf("Could not open the wallet\n"); | ||||||
| 	                        return -1; | 	                        return -1; | ||||||
| 	                } | 	                } | ||||||
|  |  | ||||||
| @@ -294,7 +294,7 @@ extern "C" | |||||||
| 	                        // Set the current folder | 	                        // Set the current folder | ||||||
|         	                if (!(wallet->setFolder(folderName))) |         	                if (!(wallet->setFolder(folderName))) | ||||||
| 		                { | 		                { | ||||||
|                 		        printf("Could not set the folder\n"); |                 		        //printf("Could not set the folder\n"); | ||||||
| 		                        return -1; | 		                        return -1; | ||||||
| 		                } | 		                } | ||||||
|  |  | ||||||
| @@ -311,7 +311,7 @@ extern "C" | |||||||
|         	                        QByteArray *secretVal = new QByteArray(); |         	                        QByteArray *secretVal = new QByteArray(); | ||||||
|         	                        if (ReadKey(wallet,key,secretVal) != 0) |         	                        if (ReadKey(wallet,key,secretVal) != 0) | ||||||
| 	                                { | 	                                { | ||||||
|                 	                        printf("Could not read \"%s\"\n",key.latin1()); |                 	                        //printf("Could not read \"%s\"\n",key.latin1()); | ||||||
|                         	                break;  |                         	                break;  | ||||||
|                                                //FIXME |                                                //FIXME | ||||||
| 	                                } | 	                                } | ||||||
| @@ -319,7 +319,7 @@ extern "C" | |||||||
|  	                               struct EnumSecretList *tempWalletSecrets = (struct EnumSecretList*)malloc(sizeof(struct EnumSecretList)); |  	                               struct EnumSecretList *tempWalletSecrets = (struct EnumSecretList*)malloc(sizeof(struct EnumSecretList)); | ||||||
|  |  | ||||||
|         	                        if (tempWalletSecrets == NULL) { |         	                        if (tempWalletSecrets == NULL) { | ||||||
|                 	                        printf("Memory Allocation failure\n"); |                 	                        //printf("Memory Allocation failure\n"); | ||||||
|                         	                return -1; |                         	                return -1; | ||||||
| 	                                } | 	                                } | ||||||
|  |  | ||||||
| @@ -327,7 +327,7 @@ extern "C" | |||||||
|  |  | ||||||
|                 	                if (tempWalletSecrets->walletName == NULL)  |                 	                if (tempWalletSecrets->walletName == NULL)  | ||||||
| 					{ | 					{ | ||||||
| 			                    printf("Memory Allocation failure\n"); | 			                    //printf("Memory Allocation failure\n"); | ||||||
| 			                    return -1; | 			                    return -1; | ||||||
| 				         } | 				         } | ||||||
|               |               | ||||||
| @@ -337,7 +337,7 @@ extern "C" | |||||||
| 		 | 		 | ||||||
|                 	                if (tempWalletSecrets->folderName == NULL)  |                 	                if (tempWalletSecrets->folderName == NULL)  | ||||||
| 					{ | 					{ | ||||||
| 	                                 	printf("Memory Allocation failure\n"); | 	                                 	//printf("Memory Allocation failure\n"); | ||||||
|         				        return -1; |         				        return -1; | ||||||
|  				         } |  				         } | ||||||
| 	 | 	 | ||||||
| @@ -368,12 +368,12 @@ extern "C" | |||||||
|                 		      QString passwd; |                 		      QString passwd; | ||||||
| 		                      convert >> passwd; | 		                      convert >> passwd; | ||||||
|                                       //QString passwd(*secretVal); |                                       //QString passwd(*secretVal); | ||||||
|                 	              printf("kwallet : ReadAll key %s value %s \n",key.latin1(), passwd.latin1()); |                 	              //printf("kwallet : ReadAll key %s value %s \n",key.latin1(), passwd.latin1()); | ||||||
|  			              tempWalletSecrets->secretVal = (char*)malloc(512); |  			              tempWalletSecrets->secretVal = (char*)malloc(512); | ||||||
|  |  | ||||||
|  	                               if (tempWalletSecrets->secretVal == NULL) |  	                               if (tempWalletSecrets->secretVal == NULL) | ||||||
|         	                       { |         	                       { | ||||||
|                                        		printf("Memory Allocation failure\n"); |                                        		//printf("Memory Allocation failure\n"); | ||||||
| 				                return -1; | 				                return -1; | ||||||
| 			               } | 			               } | ||||||
|  |  | ||||||
| @@ -430,12 +430,12 @@ int DCOPDemoWidget::SetEntry(char *name, char *foldername, int entryType, char * | |||||||
| 	        wallet = Wallet::openWallet(qWalletName,0,Wallet::Synchronous); | 	        wallet = Wallet::openWallet(qWalletName,0,Wallet::Synchronous); | ||||||
|                 if (wallet == NULL) |                 if (wallet == NULL) | ||||||
|        	        { |        	        { | ||||||
|                	        printf("Could not open the wallet %s \n", qWalletName.latin1()); |                	        //printf("Could not open the wallet %s \n", qWalletName.latin1()); | ||||||
|                         return  KWALLET_RESULT_CANNOT_OPEN_WALLET; |                         return  KWALLET_RESULT_CANNOT_OPEN_WALLET; | ||||||
|                 } |                 } | ||||||
|                 if (wallet->setFolder(qFolderName) == false) |                 if (wallet->setFolder(qFolderName) == false) | ||||||
| 		{ | 		{ | ||||||
|                	        printf("Could not open the folder %s \n", qFolderName.latin1()); |                	        //printf("Could not open the folder %s \n", qFolderName.latin1()); | ||||||
| 			return KWALLET_RESULT_CANNOT_OPEN_FOLDER; | 			return KWALLET_RESULT_CANNOT_OPEN_FOLDER; | ||||||
| 		} | 		} | ||||||
|                 QString unicodeValue = tr(value); |                 QString unicodeValue = tr(value); | ||||||
| @@ -463,7 +463,7 @@ int DCOPDemoWidget::SetEntry(char *name, char *foldername, int entryType, char * | |||||||
| //                Wallet::EntryType MyEntryType = 3; | //                Wallet::EntryType MyEntryType = 3; | ||||||
| 		if (wallet->entryType(qKey) != 3)  | 		if (wallet->entryType(qKey) != 3)  | ||||||
| 		{	 | 		{	 | ||||||
| 		        printf("kwallet : SetEntry : Before setting Entry key %s value = %s  EntryType =%d \n" , qKey.latin1() , value, entryType ); | 		        //printf("kwallet : SetEntry : Before setting Entry key %s value = %s  EntryType =%d \n" , qKey.latin1() , value, entryType ); | ||||||
| 			if (wallet->writeEntry(refQKey, refSecretVal , (Wallet::EntryType) entryType ) != 0) | 			if (wallet->writeEntry(refQKey, refSecretVal , (Wallet::EntryType) entryType ) != 0) | ||||||
|                         { |                         { | ||||||
| 				return KWALLET_RESULT_CANNOT_WRITE_ENTRY; | 				return KWALLET_RESULT_CANNOT_WRITE_ENTRY; | ||||||
| @@ -480,7 +480,7 @@ int DCOPDemoWidget::SetMap(char *name, char *foldername, char *keyname, char **v | |||||||
| 	  	QString qWalletName(name); | 	  	QString qWalletName(name); | ||||||
| 		QString qKey(keyname); | 		QString qKey(keyname); | ||||||
| 		QString qFolderName(foldername); | 		QString qFolderName(foldername); | ||||||
|                 printf("kwallet : SetMap :  Wallet %s  Folder  %s Key =%s\n", name, foldername, keyname); |                 //printf("kwallet : SetMap :  Wallet %s  Folder  %s Key =%s\n", name, foldername, keyname); | ||||||
|                |                | ||||||
|                |                | ||||||
|                 // Open the wallet |                 // Open the wallet | ||||||
| @@ -488,7 +488,7 @@ int DCOPDemoWidget::SetMap(char *name, char *foldername, char *keyname, char **v | |||||||
| 	        wallet = Wallet::openWallet(qWalletName,0,Wallet::Synchronous); | 	        wallet = Wallet::openWallet(qWalletName,0,Wallet::Synchronous); | ||||||
|                 if (wallet == NULL) |                 if (wallet == NULL) | ||||||
|        	        { |        	        { | ||||||
|                	        printf("Could not open the wallet\n"); |                	        //printf("Could not open the wallet\n"); | ||||||
|                         return  KWALLET_RESULT_CANNOT_OPEN_WALLET; |                         return  KWALLET_RESULT_CANNOT_OPEN_WALLET; | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
| @@ -529,30 +529,30 @@ int DCOPDemoWidget::RemoveEntry(char *name, char *foldername, char *keyname ) | |||||||
| 		QString qWalletName(name); | 		QString qWalletName(name); | ||||||
| 		QString qKey(keyname); | 		QString qKey(keyname); | ||||||
| 		QString qFolderName(foldername); | 		QString qFolderName(foldername); | ||||||
|                 printf("In DCOPDemoWidget:RemoveEntry\n"); |                 //printf("In DCOPDemoWidget:RemoveEntry\n"); | ||||||
|                 printf("In DCOPDemoWidget:False %d\n",false); |                 //printf("In DCOPDemoWidget:False %d\n",false); | ||||||
|                 printf("In DCOPDemoWidget:False %d\n",FALSE); |                 //printf("In DCOPDemoWidget:False %d\n",FALSE); | ||||||
|                          |                          | ||||||
|                 // Open the wallet |                 // Open the wallet | ||||||
|        		Wallet *wallet = NULL; |        		Wallet *wallet = NULL; | ||||||
| 	        wallet = Wallet::openWallet(qWalletName,0,Wallet::Synchronous); | 	        wallet = Wallet::openWallet(qWalletName,0,Wallet::Synchronous); | ||||||
|                 if (wallet == NULL) |                 if (wallet == NULL) | ||||||
|        	        { |        	        { | ||||||
|                	        printf("Could not open the wallet %s \n", qWalletName.latin1()); |                	        //printf("Could not open the wallet %s \n", qWalletName.latin1()); | ||||||
|                         return  KWALLET_RESULT_CANNOT_OPEN_WALLET; |                         return  KWALLET_RESULT_CANNOT_OPEN_WALLET; | ||||||
|                 } |                 } | ||||||
|                 if (wallet->setFolder(qFolderName) ==  false) |                 if (wallet->setFolder(qFolderName) ==  false) | ||||||
| 		{ | 		{ | ||||||
|                         printf("Could not set the folder %s \n", qFolderName.latin1()); |                         //printf("Could not set the folder %s \n", qFolderName.latin1()); | ||||||
| 			return KWALLET_RESULT_CANNOT_OPEN_FOLDER; | 			return KWALLET_RESULT_CANNOT_OPEN_FOLDER; | ||||||
| 		} | 		} | ||||||
| 		if (wallet->removeEntry(qKey) != 0) | 		if (wallet->removeEntry(qKey) != 0) | ||||||
| 		{ | 		{ | ||||||
|                         printf("Could not remove Entry  %s \n", qKey.latin1()); |                         //printf("Could not remove Entry  %s \n", qKey.latin1()); | ||||||
| 			return KWALLET_RESULT_CANNOT_REMOVE_ENTRY; | 			return KWALLET_RESULT_CANNOT_REMOVE_ENTRY; | ||||||
| 		} | 		} | ||||||
|                 wallet->sync(); |                 wallet->sync(); | ||||||
|                 printf("In DCOPDemoWidget:RemoveEntry Exit\n"); |                 //printf("In DCOPDemoWidget:RemoveEntry Exit\n"); | ||||||
| 		return KWALLET_RESULT_OK; | 		return KWALLET_RESULT_OK; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user