-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathAuth.h
More file actions
84 lines (66 loc) · 2.31 KB
/
Auth.h
File metadata and controls
84 lines (66 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
EasySFTP - Copyright (C) 2010 jet (ジェット)
Auth.h - declarations of authentication classes for SSH
*/
#pragma once
#include "SUString.h"
#define USERINFO_SIGNATURE 0x1362109A
#include "EasySFTP_h.h"
#include "Unknown.h"
#include "Dispatch.h"
enum class AuthReturnType
{
Success = 1,
Again = 0,
Error = -1
};
class CSSHAgent;
#define AUTH_SESSION_SIGNATURE 0xa0b29dff
struct CAuthSession
{
union
{
DWORD dwSignature;
void* _padding;
};
CSSHAgent* pAgent;
LPBYTE lpPageantKeyList;
LPBYTE lpCurrentKey;
DWORD dwKeyCount;
DWORD dwKeyIndex;
int nPrevFlags;
~CAuthSession();
};
class CAuthentication : public CDispatchImplT<IEasySFTPAuthentication2>
{
public:
CAuthentication();
virtual ~CAuthentication();
virtual void* GetThisForDispatch() override { return static_cast<IEasySFTPAuthentication*>(this); }
STDMETHOD(QueryInterface)(REFIID riid, void** ppv) override;
STDMETHOD(get_UserName)(BSTR* pRet) override;
STDMETHOD(put_UserName)(BSTR Name) override;
STDMETHOD(get_Password)(BSTR* pRet) override;
STDMETHOD(put_Password)(BSTR Password) override;
STDMETHOD(get_PrivateKeyFileName)(BSTR* pRet) override;
STDMETHOD(put_PrivateKeyFileName)(BSTR FileName) override;
STDMETHOD(get_Type)(EasySFTPAuthenticationMode* pMode) override;
STDMETHOD(put_Type)(EasySFTPAuthenticationMode mode) override;
STDMETHOD(get_AuthSession)(LONG_PTR* pOut) override;
STDMETHOD(put_AuthSession)(LONG_PTR session) override;
STDMETHOD(SetPrivateKeyBinary)(const void* buffer, long length) override;
STDMETHOD(GetPrivateKeyBinary)(const void** buffer, long* pLength) override;
static AuthReturnType SSHAuthenticate(IEasySFTPAuthentication2* pAuth, LIBSSH2_SESSION* pSession, LPCSTR lpszService, char** ppAuthList = NULL);
static bool CanRetry(IEasySFTPAuthentication* pAuth);
private:
static bool AssignAgentFlags(CAuthSession* pAuthSession);
static AuthReturnType SSHAuthenticateWithAgent(IEasySFTPAuthentication* pAuth, CMyStringW& strUserName, LIBSSH2_SESSION* pSession, LPCSTR lpszService, CSSHAgent* (* CreateAgent)());
public:
EasySFTPAuthenticationMode m_Mode;
CMyStringW m_strUserName;
_SecureStringW m_strPassword;
CMyStringW m_strPrivateKeyFileName;
void* m_pPrivateKeyData;
long m_nPrivateKeyData;
void* m_pSession;
};