author | Michael Krelin <hacker@klever.net> | 2006-02-02 23:07:50 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2006-02-02 23:07:50 (UTC) |
commit | 39bb4331674cc77560a546f4f9b14b143603d4be (patch) (unidiff) | |
tree | fbbc1006c655888a5483ddd359c52b863e7a27ab /ACLTargetCombo.cpp | |
parent | fedc32eb7d20e5278a2125ead3ed125dc63b5746 (diff) | |
download | pumpkin-39bb4331674cc77560a546f4f9b14b143603d4be.zip pumpkin-39bb4331674cc77560a546f4f9b14b143603d4be.tar.gz pumpkin-39bb4331674cc77560a546f4f9b14b143603d4be.tar.bz2 |
- version bump to 2.7
- year bump to 2006
- ip-based access control
- server switchable off
- logging to file
git-svn-id: http://svn.klever.net/kin/pumpkin/trunk@144 fe716a7a-6dde-0310-88d9-d003556173a8
-rw-r--r-- | ACLTargetCombo.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/ACLTargetCombo.cpp b/ACLTargetCombo.cpp new file mode 100644 index 0000000..cdbd075 --- a/dev/null +++ b/ACLTargetCombo.cpp | |||
@@ -0,0 +1,85 @@ | |||
1 | // ACLTargetCombo.cpp : implementation file | ||
2 | // | ||
3 | |||
4 | #include "stdafx.h" | ||
5 | #include "PumpKIN.h" | ||
6 | #include "PumpKINDlg.h" | ||
7 | #include "ACLTargetCombo.h" | ||
8 | |||
9 | #ifdef _DEBUG | ||
10 | #define new DEBUG_NEW | ||
11 | #undef THIS_FILE | ||
12 | static char THIS_FILE[] = __FILE__; | ||
13 | #endif | ||
14 | |||
15 | ///////////////////////////////////////////////////////////////////////////// | ||
16 | // CACLTargetCombo | ||
17 | |||
18 | CACLTargetCombo::CACLTargetCombo() | ||
19 | : m_op(-1) | ||
20 | { | ||
21 | } | ||
22 | |||
23 | CACLTargetCombo::~CACLTargetCombo() | ||
24 | { | ||
25 | } | ||
26 | |||
27 | |||
28 | BEGIN_MESSAGE_MAP(CACLTargetCombo, CComboBox) | ||
29 | //{{AFX_MSG_MAP(CACLTargetCombo) | ||
30 | // NOTE - the ClassWizard will add and remove mapping macros here. | ||
31 | //}}AFX_MSG_MAP | ||
32 | END_MESSAGE_MAP() | ||
33 | |||
34 | ///////////////////////////////////////////////////////////////////////////// | ||
35 | // CACLTargetCombo message handlers | ||
36 | |||
37 | void CACLTargetCombo::SetOp(int op) | ||
38 | { | ||
39 | m_op=op; | ||
40 | ResetContent(); | ||
41 | switch(op) { | ||
42 | case tftp::opRRQ: | ||
43 | m_tmap.RemoveAll(); | ||
44 | SetItemData(m_tmap[acl_rule::rrqNone]=AddString("fallback to global"),acl_rule::rrqNone); | ||
45 | SetItemData(m_tmap[acl_rule::rrqDeny]=AddString("deny access"),acl_rule::rrqDeny); | ||
46 | SetItemData(m_tmap[acl_rule::rrqPrompt]=AddString("prompt"),acl_rule::rrqPrompt); | ||
47 | SetItemData(m_tmap[acl_rule::rrqGrant]=AddString("grant access"),CPumpKINDlg::rrqGrant); | ||
48 | SetCurSel(0); | ||
49 | EnableWindow(TRUE); | ||
50 | break; | ||
51 | case tftp::opWRQ: | ||
52 | m_tmap.RemoveAll(); | ||
53 | SetItemData(m_tmap[acl_rule::wrqNone]=AddString("fallback to global"),acl_rule::wrqNone); | ||
54 | SetItemData(m_tmap[acl_rule::wrqDeny]=AddString("deny access"),acl_rule::wrqDeny); | ||
55 | SetItemData(m_tmap[acl_rule::wrqPrompt]=AddString("prompt"),acl_rule::wrqPrompt); | ||
56 | SetItemData(m_tmap[acl_rule::wrqPromptIfExists]=AddString("prompt if file exists"),acl_rule::wrqPromptIfExists); | ||
57 | SetItemData(m_tmap[acl_rule::wrqGrant]=AddString("grant access"),acl_rule::wrqGrant); | ||
58 | SetCurSel(0); | ||
59 | EnableWindow(TRUE); | ||
60 | break; | ||
61 | default: | ||
62 | EnableWindow(FALSE); | ||
63 | break; | ||
64 | } | ||
65 | } | ||
66 | |||
67 | int CACLTargetCombo::GetTarget() | ||
68 | { | ||
69 | int cs=GetCurSel(); | ||
70 | if(cs==CB_ERR) | ||
71 | return -1; | ||
72 | return GetItemData(cs); | ||
73 | } | ||
74 | |||
75 | void CACLTargetCombo::SetTarget(int t,int op) | ||
76 | { | ||
77 | if(op>=0) | ||
78 | SetOp(op); | ||
79 | ASSERT(m_op>=0); | ||
80 | int i; | ||
81 | if(m_tmap.Lookup(t,i)) | ||
82 | SetCurSel(i); | ||
83 | else | ||
84 | SetCurSel(0); | ||
85 | } | ||