Author: nkinder
Update of /cvs/dirsec/winsync/passwordsync
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv32422/passwordsync
Modified Files:
passhand.cpp passhand.h
Log Message:
186657 - Implemented locking around passhook data file access
Index: passhand.cpp
===================================================================
RCS file: /cvs/dirsec/winsync/passwordsync/passhand.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- passhand.cpp 22 Mar 2006 18:51:04 -0000 1.9
+++ passhand.cpp 30 Mar 2006 22:59:25 -0000 1.10
@@ -112,6 +112,8 @@
outFile.close();
exit:
+ // We need to unfreeze plainTextStream so memory gets freed by the destructor
+ plainTextStream.rdbuf()->freeze(false);
free(cipherTextBuf);
return result;
}
@@ -119,18 +121,18 @@
int loadSet(PASS_INFO_LIST* passInfoList, char* filename)
{
int result = 0;
- int i;
+ int i = 0;
fstream inFile;
PASS_INFO newPair;
strstream* plainTextStream;
char* cipherTextBuf = NULL;
char* plainTextBuf = NULL;
- int usernameLen;
- int passwordLen;
- int plainTextLen;
- int cipherTextLen;
+ int usernameLen = 0;
+ int passwordLen = 0;
+ int plainTextLen = 0;
+ int cipherTextLen = 0;
int resultTextLen = 0;
- int pairCount;
+ int pairCount = 0;
// Read in cipher text from file
inFile.open(filename, ios::in | ios::binary);
@@ -164,6 +166,12 @@
goto exit;
}
+ // Check to see if plainTextbuf contains anything
+ if (resultTextLen <= 0) {
+ result = -1;
+ goto exit;
+ }
+
plainTextStream = new strstream(plainTextBuf, resultTextLen);
plainTextStream->read((char*)&pairCount, sizeof(pairCount));
Index: passhand.h
===================================================================
RCS file: /cvs/dirsec/winsync/passwordsync/passhand.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- passhand.h 19 Apr 2005 22:07:43 -0000 1.7
+++ passhand.h 30 Mar 2006 22:59:25 -0000 1.8
@@ -50,7 +50,9 @@
#include "prerror.h"
#define PASSHAND_EVENT_NAME "passhand_event"
+#define PASSHOOK_MUTEX_NAME "passhook_mutex"
+#define PASSHOOK_TIMEOUT 30000
#define PASSHAND_BUF_SIZE 256
using namespace std;
Show replies by date