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:
@@ -41,7 +41,7 @@ public:
|
|||||||
bigtime_t PasswordTime() {return fPasswordTime;}
|
bigtime_t PasswordTime() {return fPasswordTime;}
|
||||||
const char *Password() { return fPassword.String(); }
|
const char *Password() { return fPassword.String(); }
|
||||||
const char *LockMethod() { return fLockMethod.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();}
|
const char *ModuleName() {return fModuleName.String();}
|
||||||
status_t GetState(const char *name, BMessage *stateMsg);
|
status_t GetState(const char *name, BMessage *stateMsg);
|
||||||
|
|
||||||
@@ -78,8 +78,6 @@ private:
|
|||||||
BString fModuleName;
|
BString fModuleName;
|
||||||
BString fLockMethod;
|
BString fLockMethod;
|
||||||
|
|
||||||
bool fIsNetworkPassword;
|
|
||||||
|
|
||||||
BMessage fSettings;
|
BMessage fSettings;
|
||||||
BPath fSSPath, fNetworkPath;
|
BPath fSSPath, fNetworkPath;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -94,9 +94,7 @@ ScreenSaverApp::MessageReceived(BMessage *message)
|
|||||||
switch(message->what) {
|
switch(message->what) {
|
||||||
case UNLOCK_MESSAGE:
|
case UNLOCK_MESSAGE:
|
||||||
{
|
{
|
||||||
char salt[3] = "";
|
if (strcmp(fPref.Password(), crypt(fPww->GetPassword(), fPref.Password())) != 0) {
|
||||||
strncpy(salt, fPref.Password(), 2);
|
|
||||||
if (strcmp(crypt(fPww->GetPassword(), salt),fPref.Password()) != 0) {
|
|
||||||
beep();
|
beep();
|
||||||
fPww->SetPassword("");
|
fPww->SetPassword("");
|
||||||
delete fRunner;
|
delete fRunner;
|
||||||
|
|||||||
@@ -64,10 +64,12 @@ ScreenSaverPrefs::LoadSettings()
|
|||||||
// This ugly piece opens the networking file and reads the password, if it exists.
|
// This ugly piece opens the networking file and reads the password, if it exists.
|
||||||
if ((networkFile=fopen(fNetworkPath.Path(),"r")))
|
if ((networkFile=fopen(fNetworkPath.Path(),"r")))
|
||||||
while (buffer==fgets(buffer,512,networkFile))
|
while (buffer==fgets(buffer,512,networkFile))
|
||||||
if ((start=strstr(buffer,"PASSWORD ="))) {
|
if ((start=strstr(buffer,"PASSWORD = "))) {
|
||||||
char password[12];
|
char password[14];
|
||||||
strncpy(password, start+10,strlen(start-11));
|
strncpy(password, start+11,strlen(start+11)-1);
|
||||||
|
password[strlen(start+11)-1] = 0;
|
||||||
fPassword = password;
|
fPassword = password;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -124,7 +126,10 @@ ScreenSaverPrefs::GetSettings()
|
|||||||
fSettings.AddInt32("cornernever", fNeverBlankCorner);
|
fSettings.AddInt32("cornernever", fNeverBlankCorner);
|
||||||
fSettings.AddBool("lockenable", fLockEnabled);
|
fSettings.AddBool("lockenable", fLockEnabled);
|
||||||
fSettings.AddInt32("lockdelay", fPasswordTime/1000000);
|
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("lockmethod", fLockMethod);
|
||||||
fSettings.AddString("modulename", fModuleName);
|
fSettings.AddString("modulename", fModuleName);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user