Author: rmeggins
Update of /cvs/dirsec/winsync/passwordsync/passsync In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv8461/passwordsync/passsync
Modified Files: syncserv.cpp syncserv.h Log Message: Resolves: bug 471408 Description: PassSync logs a bogus error message Reviewed by: nkinder Fix Description: Just see if the file does not yet exist. If that is the case (err == ENOENT), then return a non-fatal error. I also fixed a usage of list iterator - apparently it is not a pointer type, and should be passed by reference rather than by value. Without this fix, I could not compile using Visual C++ 9.0 Express Edition Platforms tested: Windows 2003 Server Flag Day: no Doc impact: no
Index: syncserv.cpp =================================================================== RCS file: /cvs/dirsec/winsync/passwordsync/passsync/syncserv.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- syncserv.cpp 30 Mar 2006 22:59:26 -0000 1.14 +++ syncserv.cpp 13 Feb 2009 23:39:44 -0000 1.15 @@ -133,7 +133,7 @@ if(outLog.is_open()) { timeStamp(&outLog); - outLog << "PassSync service started" << endl; + outLog << "PassSync service initialized" << endl; }
PK11_SetPasswordFunc(passwdcb); @@ -177,6 +177,12 @@ // **************************************************************** void PassSyncService::Run() { + if(outLog.is_open()) + { + timeStamp(&outLog); + outLog << "PassSync service running" << endl; + } + isRunning = true;
// Initialize NSS @@ -231,11 +237,12 @@
if(passInfoList.size() > 0) { + int result = 0; // Get mutex for passhook.dat WaitForSingleObject(passhookMutexHandle, INFINITE);
// Need to loadSet here so we don't overwrite entries that passhook recently added - if(loadSet(&passInfoList, dataFilename) == 0) + if((result = loadSet(&passInfoList, dataFilename)) == 0) { if(saveSet(&passInfoList, dataFilename) == 0) { @@ -250,6 +257,9 @@ timeStamp(&outLog); outLog << "Failed to save entries to data file" << endl; } + } else if (result == 1) { + timeStamp(&outLog); + outLog << "No entries yet" << endl; } else { timeStamp(&outLog); outLog << "Failed to load entries from file" << endl; @@ -280,7 +290,7 @@ // Get mutex for passhook.dat WaitForSingleObject(passhookMutexHandle, INFINITE);
- if(loadSet(&passInfoList, dataFilename) == 0) + if((result = loadSet(&passInfoList, dataFilename)) == 0) { if((passInfoList.size() - tempSize) > 0) { @@ -305,6 +315,11 @@ } } } + else if (result == 1) + { + timeStamp(&outLog); + outLog << "No entries yet" << endl; + } else { timeStamp(&outLog); @@ -580,12 +595,12 @@ // **************************************************************** // PassSyncService::FutureOccurrence // **************************************************************** -bool PassSyncService::FutureOccurrence(PASS_INFO_LIST_ITERATOR startingPassInfo) +bool PassSyncService::FutureOccurrence(PASS_INFO_LIST_ITERATOR &startingPassInfo) { bool result = false; PASS_INFO_LIST_ITERATOR currentPassInfo;
- if((startingPassInfo != NULL) && (startingPassInfo != passInfoList.end())) + if((startingPassInfo._Ptr) && (startingPassInfo != passInfoList.end())) { currentPassInfo = startingPassInfo; currentPassInfo++;
Index: syncserv.h =================================================================== RCS file: /cvs/dirsec/winsync/passwordsync/passsync/syncserv.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- syncserv.h 30 Mar 2006 22:59:26 -0000 1.8 +++ syncserv.h 13 Feb 2009 23:39:44 -0000 1.9 @@ -64,7 +64,6 @@ void Run();
int SyncPasswords(); - private: int Connect(LDAP** connection, char* dn, char* auth); int Disconnect(LDAP** connection); @@ -72,7 +71,7 @@ char* GetDN(); int ModifyPassword(char* dn, char* password);
- bool FutureOccurrence(PASS_INFO_LIST_ITERATOR startingPassInfo); + bool FutureOccurrence(PASS_INFO_LIST_ITERATOR &startingPassInfo); bool MultipleResults(); bool CanBind(char* dn, char* password);