Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

106 lines
4.4 KiB

//---------------------------------------------------------------------------
// SetPass.h
//
// Comment: This is a COM object extension for the MCS DCTAccountReplicator.
// This object implements the IExtendAccountMigration interface.
// The process method of this object sets the password for the
// target account according to the users specification.
//
// (c) Copyright 1995-1998, Mission Critical Software, Inc., All Rights Reserved
//
// Proprietary and confidential to Mission Critical Software, Inc.
//---------------------------------------------------------------------------
#ifndef __SETPASSWORD_H_
#define __SETPASSWORD_H_
#include "resource.h" // main symbols
#include "CommaLog.hpp"
#include "ExtSeq.h"
#include "ADMTCrypt.h"
#import "VarSet.tlb" no_namespace rename("property", "aproperty")
#import "MsPwdMig.tlb" no_namespace
/////////////////////////////////////////////////////////////////////////////
// CSetPassword
class ATL_NO_VTABLE CSetPassword :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<CSetPassword, &CLSID_SetPassword>,
public IDispatchImpl<IExtendAccountMigration, &IID_IExtendAccountMigration, &LIBID_SETTARGETPASSWORDLib>
{
public:
CSetPassword() : m_bTriedToOpenFile(false)
{
m_sName = L"Set Target Password";
m_sDesc = L"Sets the target password and other related options.";
m_Sequence = AREXT_LATER_SEQUENCE_NUMBER;
m_bEstablishedSession = false;
m_bUCCPFlagSet = false;
m_bUMCPNLFlagSet = false;
m_bPNEFlagSet = false;
m_pTgtCrypt = NULL;
m_sUndoneUsers = L",";
m_lPwdHistoryLength = -1;
m_nPasswordServerVersion = 0;
}
~CSetPassword()
{
mUCCPMap.RemoveAll();
mMigTimeMap.RemoveAll();
m_passwordLog.LogClose();
delete m_pTgtCrypt;
}
DECLARE_REGISTRY_RESOURCEID(IDR_SETPASSWORD)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CSetPassword)
COM_INTERFACE_ENTRY(IExtendAccountMigration)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
// IExtendAccountMigration
public:
STDMETHOD(ProcessUndo)(/*[in]*/ IUnknown * pSource, /*[in]*/ IUnknown * pTarget, /*[in]*/ IUnknown * pMainSettings, /*[in, out]*/ IUnknown ** pPropToSet, /*[in,out]*/ EAMAccountStats* pStats);
STDMETHOD(PreProcessObject)(/*[in]*/ IUnknown * pSource, /*[in]*/ IUnknown * pTarget, /*[in]*/ IUnknown * pMainSettings, /*[in,out]*/ IUnknown ** ppPropsToSet, /*[in,out]*/ EAMAccountStats* pStats);
STDMETHOD(ProcessObject)(/*[in]*/ IUnknown * pSource, /*[in]*/ IUnknown * pTarget, /*[in]*/ IUnknown * pMainSettings, /*[in,out]*/ IUnknown ** ppPropsToSet, /*[in,out]*/ EAMAccountStats* pStats);
STDMETHOD(get_sDesc)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_sDesc)(/*[in]*/ BSTR newVal);
STDMETHOD(get_sName)(/*[out, retval]*/ BSTR *pVal);
STDMETHOD(put_sName)(/*[in]*/ BSTR newVal);
STDMETHOD(get_SequenceNumber)(/*[out, retval]*/ LONG * value) { (*value) = m_Sequence; return S_OK; }
private:
_bstr_t m_sDesc;
_bstr_t m_sName;
CPasswordLog m_passwordLog; //Password file
bool m_bTriedToOpenFile;
long m_Sequence;
bool m_bEstablishedSession;
CTargetCrypt * m_pTgtCrypt;
bool m_bUCCPFlagSet;
bool m_bUMCPNLFlagSet;
bool m_bPNEFlagSet;
long m_lPwdHistoryLength;
int m_nPasswordServerVersion;
CMapStringToString mUCCPMap;
CMapStringToString mMigTimeMap;
_bstr_t m_sUndoneUsers;
IPasswordMigrationPtr m_pPwdMig;
BOOL GetDirectory(WCHAR* filename);
bool IsValidPassword(LPCWSTR pwszPassword);
HRESULT CopyPassword(_bstr_t srcServer, _bstr_t tgtServer, _bstr_t srcName, _bstr_t tgtName, _bstr_t password, EAMAccountStats* pStats);
void SetUserMustChangePwdFlag(IUnknown *pTarget);
void RecordPwdFlags(LPCWSTR pwszMach, LPCWSTR pwszUser);
void ResetPwdFlags(IUnknown *pTarget, LPCWSTR pwszMach, LPCWSTR pwszUser);
void ClearUserCanChangePwdFlag(LPCWSTR pwszMach, LPCWSTR pwszUser);
BOOL CanCopyPassword(IVarSet * pVarSet, LPCWSTR pwszMach, LPCWSTR pwszUser, UINT& uMsgId);
void MarkAccountError(IVarSet* pVarSet);
};
#endif //__SETPASSWORD_H_