fix for network password

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14099 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2005-09-01 15:04:18 +00:00
parent 1b4b6d54f3
commit 008b1d9008
3 changed files with 11 additions and 10 deletions

View File

@ -41,7 +41,7 @@ public:
bigtime_t PasswordTime() {return fPasswordTime;}
const char *Password() { return fPassword.String(); }
const char *LockMethod() { return fLockMethod.String(); }
bool IsNetworkPassword() {return fIsNetworkPassword;}
bool IsNetworkPassword() {return (strcmp(fLockMethod.String(), "custom") != 0);}
const char *ModuleName() {return fModuleName.String();}
status_t GetState(const char *name, BMessage *stateMsg);
@ -78,8 +78,6 @@ private:
BString fModuleName;
BString fLockMethod;
bool fIsNetworkPassword;
BMessage fSettings;
BPath fSSPath, fNetworkPath;
};

View File

@ -94,9 +94,7 @@ ScreenSaverApp::MessageReceived(BMessage *message)
switch(message->what) {
case UNLOCK_MESSAGE:
{
char salt[3] = "";
strncpy(salt, fPref.Password(), 2);
if (strcmp(crypt(fPww->GetPassword(), salt),fPref.Password()) != 0) {
if (strcmp(fPref.Password(), crypt(fPww->GetPassword(), fPref.Password())) != 0) {
beep();
fPww->SetPassword("");
delete fRunner;

View File

@ -64,10 +64,12 @@ ScreenSaverPrefs::LoadSettings()
// This ugly piece opens the networking file and reads the password, if it exists.
if ((networkFile=fopen(fNetworkPath.Path(),"r")))
while (buffer==fgets(buffer,512,networkFile))
if ((start=strstr(buffer,"PASSWORD ="))) {
char password[12];
strncpy(password, start+10,strlen(start-11));
if ((start=strstr(buffer,"PASSWORD = "))) {
char password[14];
strncpy(password, start+11,strlen(start+11)-1);
password[strlen(start+11)-1] = 0;
fPassword = password;
break;
}
}
return true;
@ -124,7 +126,10 @@ ScreenSaverPrefs::GetSettings()
fSettings.AddInt32("cornernever", fNeverBlankCorner);
fSettings.AddBool("lockenable", fLockEnabled);
fSettings.AddInt32("lockdelay", fPasswordTime/1000000);
fSettings.AddString("lockpassword", fPassword);
if (IsNetworkPassword())
fSettings.AddString("lockpassword", "");
else
fSettings.AddString("lockpassword", fPassword);
fSettings.AddString("lockmethod", fLockMethod);
fSettings.AddString("modulename", fModuleName);