[Fedora-directory-commits] ldapserver/ldap/synctools/passwordsync passhand.cpp, 1.7.2.2, 1.7.2.3 passhand.h, 1.7, 1.7.2.1
Nathan Kinder (nkinder)
fedora-directory-commits at redhat.com
Thu Mar 30 23:09:01 UTC 2006
Author: nkinder
Update of /cvs/dirsec/ldapserver/ldap/synctools/passwordsync
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2067/passwordsync
Modified Files:
Tag: Directory71RtmBranch
passhand.cpp passhand.h
Log Message:
186657 - Implemented locking around passhook data file access
Index: passhand.cpp
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/synctools/passwordsync/passhand.cpp,v
retrieving revision 1.7.2.2
retrieving revision 1.7.2.3
diff -u -r1.7.2.2 -r1.7.2.3
--- passhand.cpp 22 Mar 2006 18:53:26 -0000 1.7.2.2
+++ passhand.cpp 30 Mar 2006 23:08:57 -0000 1.7.2.3
@@ -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/ldapserver/ldap/synctools/passwordsync/passhand.h,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- passhand.h 19 Apr 2005 22:07:43 -0000 1.7
+++ passhand.h 30 Mar 2006 23:08:57 -0000 1.7.2.1
@@ -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;
More information about the Fedora-directory-commits
mailing list