main/bsod.cpp: replace password configentry values with "X" before adding them to...
authoracid-burn <acidburn@opendreambox.org>
Sat, 3 Oct 2009 09:29:04 +0000 (11:29 +0200)
committeracid-burn <acidburn@opendreambox.org>
Sat, 3 Oct 2009 09:29:04 +0000 (11:29 +0200)
So now no passwords from the enigma2 settings file are added to the crashlogs if crashlog anonymizations is disabled.
Attention: Only config entries named "password" are considered as password fields. So use  "password" as the name of your password configentry. for example: config.myplugin.password !

main/bsod.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index fde4146..45f97c6
@@ -74,7 +74,7 @@ static std::string getConfigFileValue(const char *entry)
                {
                        return configvalue;
                }
                {
                        return configvalue;
                }
-               else // get Value from enigma2 settings file
+               else // get value from enigma2 settings file
                {
                        FILE *f = fopen(configfile.c_str(), "r");
                        if (!f)
                {
                        FILE *f = fopen(configfile.c_str(), "r");
                        if (!f)
@@ -119,7 +119,21 @@ static std::string getFileContent(const char *file)
                        char line[1024];
                        if (!fgets(line, 1024, f))
                                break;
                        char line[1024];
                        if (!fgets(line, 1024, f))
                                break;
-                       filecontent += line;
+                       std::string tmp = line;
+                       std::string password;
+                       int pwdpos = tmp.find(".password=", 0);
+                       if( pwdpos != std::string::npos)
+                       {
+                               filecontent += tmp.substr(0,pwdpos +10);
+                               for ( int pos = pwdpos +10; pos < tmp.length()-1; ++pos )
+                               {
+                                       filecontent += "X";
+                               }
+                               filecontent += "\n";
+                       }
+                       else {
+                               filecontent += line;
+                       }
                }
                fclose(f);
        }
                }
                fclose(f);
        }