Welcome to mirror list, hosted at ThFree Co, Russian Federation.

NesMiniAuthHandler.cs « FtpServer - github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3da4c2b71689cdcd2e8c6002af0e49fd689a19c7 (plain)
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
using System;
using System.Net;

namespace mooftpserv
{
    public class NesMiniAuthHandler : IAuthHandler
    {
        private IPEndPoint peer;

        public NesMiniAuthHandler()
        {
        }

        private NesMiniAuthHandler(IPEndPoint peer)
        {
          this.peer = peer;
        }

        public IAuthHandler Clone(IPEndPoint peer)
        {
            return new NesMiniAuthHandler(peer);
        }

        public bool AllowLogin(string user, string pass)
        {
            return (user == "root" && pass == "clover");
        }

        public bool AllowControlConnection()
        {
            return true;
        }

        public bool AllowActiveDataConnection(IPEndPoint port)
        {
            // only allow active connections to the same peer as the control connection
            return peer.Address.Equals(port.Address);
        }
    }
}