WIP FTP stuff

This commit is contained in:
mysticbbs 2013-09-22 20:53:25 -04:00
parent 43a1f3a0ed
commit 4533cc7e23
6 changed files with 79 additions and 40 deletions

View File

@ -309,9 +309,9 @@ Begin
Box.Header := ' FTP Server ';
Box.Open (26, 7, 55, 18);
Box.Open (26, 7, 55, 19);
VerticalLine (47, 9, 16);
VerticalLine (47, 9, 17);
Form.AddBol ('U', ' Use FTP Server', 31, 9, 49, 9, 16, 3, @bbsCfg.inetFTPUse, Topic + 'Enable FTP server');
Form.AddWord ('P', ' Server Port', 34, 10, 49, 10, 13, 5, 0, 65535, @bbsCfg.inetFTPPort, Topic + 'FTP Server port');
@ -321,6 +321,7 @@ Begin
Form.AddWord ('I', ' Data Port Min', 32, 14, 49, 14, 15, 5, 0, 65535, @bbsCfg.inetFTPPortMin, Topic + 'Passive port range (minimum)');
Form.AddWord ('A', ' Data Port Max', 32, 15, 49, 15, 15, 5, 0, 65535, @bbsCfg.inetFTPPortMax, Topic + 'Passive port range (maximum)');
Form.AddBol ('Y', ' Allow Passive', 32, 16, 49, 16, 15, 3, @bbsCfg.inetFTPPassive, Topic + 'Allow passive data transfers');
Form.AddBol ('Q', ' Hide User QWK', 31, 17, 49, 17, 15, 3, @bbsCfg.inetFTPHideQWK, Topic + 'Hide QWK packets in listings');
Form.Execute;
Form.Free;

View File

@ -105,8 +105,8 @@ Const
re_UserOkay = '331 User name okay, need password.';
re_NoData = '425 Unable to open data connection';
re_BadCommand = '503 Bad sequence of commands.';
re_UserUnknown = '530 Not logged in.';
re_BadPW = '530 Login or password incorrect';
// re_UserUnknown = '530 Not logged in.';
re_BadPW = '530 Invalid login';
re_BadDir = '550 Directory change failed';
re_BadFile = '550 File not found';
re_NoAccess = '550 Access denied';
@ -570,6 +570,7 @@ Begin
// update user stats posts and bbs history if not networked
End;
(*
Procedure TFTPServer.cmdUSER;
Begin
ResetSession;
@ -581,7 +582,21 @@ Begin
End Else
Client.WriteLine(re_UserUnknown);
End;
*)
Procedure TFTPServer.cmdUSER;
Begin
ResetSession;
If SearchForUser(Data, User, UserPos) Then
UserName := Data
Else
UserPos := -1;
Client.WriteLine(re_UserOkay);
End;
(*
Procedure TFTPServer.cmdPASS;
Begin
If (UserName = '') or (UserPos = -1) Then Begin
@ -600,6 +615,26 @@ Begin
End Else
Client.WriteLine(re_BadPW);
End;
*)
Procedure TFTPServer.cmdPASS;
Begin
If UserName = '' Then Begin
Client.WriteLine ('332 Need account');
Exit;
End;
If (UserPos <> -1) and (strUpper(Data) = User.Password) Then Begin
LoggedIn := True;
Client.WriteLine(re_LoggedIn);
GetSecurityLevel(User.Security, SecLevel);
Server.Status (ProcessID, User.Handle + ' logged in');
End Else
Client.WriteLine(re_BadPW);
End;
Procedure TFTPServer.cmdREIN;
Begin
@ -632,8 +667,6 @@ Begin
End;
Procedure TFTPServer.cmdPASV;
//Var
// WaitSock : TIOSocket;
Begin
If LoggedIn Then Begin
If Not bbsCfg.inetFTPPassive Then Begin
@ -652,30 +685,6 @@ Begin
Client.WriteLine(re_PassiveOK + '(' + strReplace(Client.HostIP, '.', ',') + ',' + strI2S(WordRec(DataPort).Hi) + ',' + strI2S(WordRec(DataPort).Lo) + ').');
IsPassive := True;
(*
WaitSock := TIOSocket.Create;
WaitSock.FTelnetServer := False;
WaitSock.FTelnetClient := False;
{$IFDEF FTPDEBUG} LOG('PASV Init'); {$ENDIF}
WaitSock.WaitInit(bbsCfg.inetInterface, DataPort);
{$IFDEF FTPDEBUG} LOG('PASV Wait'); {$ENDIF}
DataSocket := WaitSock.WaitConnection(10000);
{$IFDEF FTPDEBUG} LOG('PASV WaitDone'); {$ENDIF}
If Not Assigned(DataSocket) Then Begin
WaitSock.Free;
Client.WriteLine(re_NoData);
Exit;
End;
WaitSock.Free;
*)
End Else
Client.WriteLine(re_BadCommand);
End;
@ -736,8 +745,8 @@ Begin
OpenDataSession;
// if qwlbyFTP.acs then
DataSocket.WriteLine(bbsCfg.QwkBBSID + '.qwk');
If Not bbsCfg.inetFTPHideQWK Then
DataSocket.WriteLine(bbsCfg.QwkBBSID + '.qwk');
DirFile := TFileBuffer.Create(FileBufSize);
@ -794,8 +803,8 @@ Begin
{$IFDEF FTPDEBUG} LOG('Back from data session'); {$ENDIF}
// if qwlbyFTP.acs then
DataSocket.WriteLine('-rw-r--r-- 1 ftp ftp ' + strPadL('0', 13, ' ') + ' ' + GetFTPDate(CurDateDos) + ' ' + bbsCfg.QwkBBSID + '.qwk');
If Not bbsCfg.inetFTPHideQWK Then
DataSocket.WriteLine('-rw-r--r-- 1 ftp ftp ' + strPadL('0', 13, ' ') + ' ' + GetFTPDate(CurDateDos) + ' ' + bbsCfg.QwkBBSID + '.qwk');
FBaseFile := TFileBuffer.Create(FileBufSize);
@ -841,7 +850,8 @@ Begin
DirFile.Free;
DataSocket.WriteLine('-rw-r--r-- 1 ftp ftp ' + strPadL('0', 13, ' ') + ' ' + GetFTPDate(CurDateDos) + ' ' + bbsCfg.QwkBBSID + '.qwk');
If Not bbsCfg.inetFTPHideQWK Then
DataSocket.WriteLine('-rw-r--r-- 1 ftp ftp ' + strPadL('0', 13, ' ') + ' ' + GetFTPDate(CurDateDos) + ' ' + bbsCfg.QwkBBSID + '.qwk');
CloseDataSession;
End Else
@ -1171,7 +1181,7 @@ Begin
LOG('Cmd: ' + Cmd + ' Data: ' + Data);
{$ENDIF}
// Server.Status (ProcessID, 'Cmd: ' + Cmd + ' Data: ' + Data);
Server.Status (ProcessID, 'Cmd: ' + Cmd + ' Data: ' + Data);
If Cmd = 'APPE' Then cmdSTOR(True) Else
If Cmd = 'CDUP' Then cmdCDUP Else
@ -1210,7 +1220,8 @@ Begin
If GotQuit Then Begin
Client.WriteLine(re_Goodbye);
Server.Status (ProcessID, User.Handle + ' logged out');
If UserPos <> -1 Then
Server.Status (ProcessID, User.Handle + ' logged out');
End;
End;

View File

@ -46,8 +46,6 @@ Begin
MB^.SetPriv ((PKT.MsgHDR.Attribute AND pktPrivate <> 0) OR NetMail);
MB^.SetCrash (PKT.MsgHDR.Attribute AND pktCrash <> 0);
MB^.SetRcvd (PKT.MsgHDR.Attribute AND pktReceived <> 0);
//MB^.SetSent (PKT.MsgHDR.Attribute AND pktSent <> 0);
// MB^.SetSent (NetMail);
MB^.SetSent (False); // force to send to downlinks?
MB^.SetHold (PKT.MsgHDR.Attribute AND pktHold <> 0);
MB^.SetKillSent (PKT.MsgHDR.Attribute AND pktKillSent <> 0);

View File

@ -1,5 +1,26 @@
Program QwkPoll;
// ====================================================================
// Mystic BBS Software Copyright 1997-2013 By James Coyle
// ====================================================================
//
// This file is part of Mystic BBS.
//
// Mystic BBS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Mystic BBS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Mystic BBS. If not, see <http://www.gnu.org/licenses/>.
//
// ====================================================================
{$I M_OPS.PAS}
Uses

View File

@ -362,7 +362,8 @@ Type
inetBINKPTimeOut: Word;
inetBINKPCram5 : Boolean;
QwkNetMenu : String[20];
Reserved : Array[1..757] of Char;
inetFTPHideQWK : Boolean;
Reserved : Array[1..756] of Char;
End;
Const

View File

@ -3827,4 +3827,11 @@
will now change any filenames (calculated from ECHOTAG) to replace both
\ and / with a _ character.
+ Mystic echomail nodes can now be configured as a "FTP" session type, which
means Mystic (FIDOPOLL) will send/receive bundles with their uplink using
the FTP protocol (as opposed to BINKP or Directory).
+ Added the ability to turn off showing the user's QWK packet in FTP
directory listings (Internet Servers > FTP)
<ALPHA 38 RELEASED>