mnet ftpd

This commit is contained in:
Andrew Pamment 2018-05-26 20:01:47 +10:00
parent 75f6d69b95
commit cb0a0b0999
4 changed files with 1307 additions and 0 deletions

52
utils/mnetftpd/Makefile Normal file
View File

@ -0,0 +1,52 @@
OS := $(shell uname -s)
ifeq ($(OS), FreeBSD)
CC=cc
CFLAGS=-I/usr/local/include
LDFLAGS=-L/usr/local/lib
endif
ifeq ($(OS), DragonFly)
CC=cc
CFLAGS=-I/usr/local/include
LDFLAGS=-L/usr/local/lib
endif
ifeq ($(OS), NetBSD)
CC=cc
CFLAGS=-I/usr/pkg/include
LDFLAGS=-R/usr/pkg/lib -L/usr/pkg/lib
endif
ifeq ($(OS), OpenBSD)
CC=cc
CFLAGS=-I/usr/local/include
LDFLAGS=-L/usr/local/lib -lsqlite3
endif
ifeq ($(OS), Linux)
CC=gcc
CFLAGS=
LDFLAGS=
endif
ifeq ($(OS), Darwin)
CC=cc
CFLAGS=-I/opt/local/include
LDFLAGS=-L/opt/local/lib
endif
ifeq ($(OS), SunOS)
CC=gcc
CFLAGS=
LDFLAGS=-lsocket -lnsl
endif
DEPS = mnetftpd.c
OBJ = mnetftpd.o ../../src/inih/ini.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
mnetftpd: $(OBJ)
$(CC) -o mnetftpd $^ $(CFLAGS) $(LDFLAGS)
.PHONY: clean
clean:
rm -f $(OBJ) mnetftpd

1204
utils/mnetftpd/mnetftpd.c Normal file

File diff suppressed because it is too large Load Diff

35
utils/mnetftpd/mnetftpd.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef __MAGIFTPD_H
#define __MAGIFTPD_H
struct user_t {
char *username;
char *password;
char *indir;
char *outdir;
};
struct ftpclient {
int fd;
int data_socket;
char *current_path;
char data_ip[INET6_ADDRSTRLEN];
int data_port;
int type;
char ip[INET6_ADDRSTRLEN];
char hostip[INET6_ADDRSTRLEN];
int data_srv_socket;
int status;
int ipver;
int authenticated;
struct user_t *user;
};
struct ftpserver {
int port;
int min_passive_port;
int max_passive_port;
int last_passive_port;
int ipv6;
};
#endif

View File

@ -0,0 +1,16 @@
[Main]
; Port to listen on
Port = 2121
Min Passive Port = 60000
Max Passive Port = 65000
Enable IPv6 = true
[andrew]
password = secret
in directory = /home/andrew/MagickaBBS/mnet/out/2
out directory = /home/andrew/MagickaBBS/mnet/in
[bob]
password = secret2
in directory = /home/andrew/MagickaBBS/mnet/out/3
out directory = /home/andrew/MagickaBBS/mnet/in