diff options
author | David Boreham <dboreham@redhat.com> | 2005-04-05 23:14:19 +0000 |
---|---|---|
committer | David Boreham <dboreham@redhat.com> | 2005-04-05 23:14:19 +0000 |
commit | 341bc2d643f3bca9064aa11a8774299abf0545ac (patch) | |
tree | 621cb71488bd851476a8647a7cf83a99c59e03e4 /ldap/synctools/passwordsync/passhook/passhook.cpp | |
parent | 2ab2ba7aa99be22a8d8c871786704a6149b9e7ce (diff) | |
download | ds-341bc2d643f3bca9064aa11a8774299abf0545ac.tar.gz ds-341bc2d643f3bca9064aa11a8774299abf0545ac.tar.xz ds-341bc2d643f3bca9064aa11a8774299abf0545ac.zip |
Change password sync copyright notices, merge fixes to password sync code
Diffstat (limited to 'ldap/synctools/passwordsync/passhook/passhook.cpp')
-rw-r--r-- | ldap/synctools/passwordsync/passhook/passhook.cpp | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/ldap/synctools/passwordsync/passhook/passhook.cpp b/ldap/synctools/passwordsync/passhook/passhook.cpp index a3480adf..d39a0abf 100644 --- a/ldap/synctools/passwordsync/passhook/passhook.cpp +++ b/ldap/synctools/passwordsync/passhook/passhook.cpp @@ -1,3 +1,8 @@ +/* --- BEGIN COPYRIGHT BLOCK --- + * Copyright (C) 2005 Red Hat, Inc. + * All rights reserved. + * --- END COPYRIGHT BLOCK --- */ + // Created: 2-8-2005 // Author(s): Scott Bridges #include <windows.h> @@ -16,7 +21,8 @@ NTSTATUS NTAPI PasswordChangeNotify(PUNICODE_STRING UserName, ULONG RelativeId, char singleByteUsername[PASSHAND_BUF_SIZE]; char singleBytePassword[PASSHAND_BUF_SIZE]; HANDLE passhookEventHandle = OpenEvent(EVENT_MODIFY_STATE, FALSE, PASSHAND_EVENT_NAME); - PasswordHandler ourPasswordHandler; + PASS_INFO newPassInfo; + PASS_INFO_LIST passInfoList; fstream outLog; outLog.open("passhook.log", ios::out | ios::app); @@ -29,16 +35,49 @@ NTSTATUS NTAPI PasswordChangeNotify(PUNICODE_STRING UserName, ULONG RelativeId, if(outLog.is_open()) { timeStamp(&outLog); - outLog << "user " << singleByteUsername << "(" << UserName->Length / 2 << ") " << "password changed" << endl; + outLog << "user " << singleByteUsername << " password changed" << endl; + } + + if(loadSet(&passInfoList, "passhook.dat") == 0) + { + if(outLog.is_open()) + { + timeStamp(&outLog); + outLog << passInfoList.size() << " entries loaded from file" << endl; + } + } + else + { + if(outLog.is_open()) + { + timeStamp(&outLog); + outLog << "failed to load entries from file" << endl; + } } - ourPasswordHandler.LoadSet("passhook.dat"); - ourPasswordHandler.PushUserPass(singleByteUsername, singleBytePassword); - ourPasswordHandler.SaveSet("passhook.dat"); + newPassInfo.username = singleByteUsername; + newPassInfo.password = singleBytePassword; + passInfoList.push_back(newPassInfo); + + if(saveSet(&passInfoList, "passhook.dat") == 0) + { + if(outLog.is_open()) + { + timeStamp(&outLog); + outLog << passInfoList.size() << " entries saved to file" << endl; + } + } + else + { + if(outLog.is_open()) + { + timeStamp(&outLog); + outLog << "failed to save entries to file" << endl; + } + } if(passhookEventHandle == NULL) { - // ToDo: generate event sync service not running. if(outLog.is_open()) { timeStamp(&outLog); |