aboutsummaryrefslogtreecommitdiff
path: root/sftp_server
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2005-09-20 14:26:04 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2005-09-20 14:26:04 +0000
commitc0525750fd090bca0f1ab1884cc26ecd227addb7 (patch)
tree47146a60b2556bb844e1265a377726d8750835be /sftp_server
parent0c1ca983edd3859acd8c1a02b8db69fd62ca89b6 (diff)
downloadlibssh-c0525750fd090bca0f1ab1884cc26ecd227addb7.tar.gz
libssh-c0525750fd090bca0f1ab1884cc26ecd227addb7.tar.xz
libssh-c0525750fd090bca0f1ab1884cc26ecd227addb7.zip
ssh-1 small modulus server keys patch
acl bases in mercurius git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@37 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'sftp_server')
-rw-r--r--sftp_server/Makefile2
-rw-r--r--sftp_server/Makefile.in2
-rw-r--r--sftp_server/acl.c31
-rw-r--r--sftp_server/server.h43
4 files changed, 76 insertions, 2 deletions
diff --git a/sftp_server/Makefile b/sftp_server/Makefile
index e3cfecbe..325e2bb4 100644
--- a/sftp_server/Makefile
+++ b/sftp_server/Makefile
@@ -1,4 +1,4 @@
-OBJECTS= main.o config.o list.o protocol.o userauth.o \
+OBJECTS= main.o config.o list.o protocol.o userauth.o file.o acl.o \
libconfig/libconfig.a ../libssh/libssh.a
SHELL = /bin/sh
diff --git a/sftp_server/Makefile.in b/sftp_server/Makefile.in
index 47061d00..55c9f3cf 100644
--- a/sftp_server/Makefile.in
+++ b/sftp_server/Makefile.in
@@ -1,4 +1,4 @@
-OBJECTS= main.o config.o list.o protocol.o userauth.o \
+OBJECTS= main.o config.o list.o protocol.o userauth.o file.o acl.o \
libconfig/libconfig.a ../libssh/libssh.a
SHELL = /bin/sh
VPATH = @srcdir@
diff --git a/sftp_server/acl.c b/sftp_server/acl.c
new file mode 100644
index 00000000..31c448e5
--- /dev/null
+++ b/sftp_server/acl.c
@@ -0,0 +1,31 @@
+/* Access control lists*/
+/*
+Copyright 2005 Aris Adamantiadis
+
+This file is part of the SSH Library
+
+The SSH Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The SSH Library 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 Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the SSH Library; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+MA 02111-1307, USA. */
+#include "server.h"
+
+int acl_open(char *file, int mode);
+int acl_opendir(char *dir);
+int acl_stat(char *file);
+int acl_rm(char *file);
+int acl_rmdir(char *dir);
+int acl_mv(char *from, char *to);
+int acl_mkdir(char *dir);
+int acl_symlink(char *from, char *to);
+int acl_setstat(char *file);
diff --git a/sftp_server/server.h b/sftp_server/server.h
index f4f30a27..b37b1fb4 100644
--- a/sftp_server/server.h
+++ b/sftp_server/server.h
@@ -44,3 +44,46 @@ struct dir {
list *Write;
};
+/* acl_* functions returns this : */
+/* 1 : operation allowed */
+/* 0 : operation denied */
+int acl_open(char *file, int mode);
+int acl_opendir(char *dir);
+int acl_stat(char *file);
+int acl_rm(char *file);
+int acl_rmdir(char *dir);
+int acl_mv(char *from, char *to);
+int acl_mkdir(char *dir);
+int acl_symlink(char *from, char *to);
+int acl_setstat(char *file);
+
+/* still experimental */
+
+#define BLOCKLEN 65536
+
+/* here is how it works : */
+/* the buffer is BLOCKLEN long. */
+/* Bytes is the number of valid bytes into the buffer. these valid bytes */
+/* begin at &buffer[0] */
+/* buffer+start is mapped at offset. */
+/* thus, there are (bytes-start) bytes ready to be read. */
+
+struct file {
+ int fd;
+ u64 offset;
+ unsigned char buffer[BLOCKLEN];
+ int bytes;
+ int start; // number of the first byte pointed by offset
+ int mode;
+ int eof;
+ int delayed_write; /* there are data into the buffer to be read */
+ int write_end; /* end of data, relative to buffer[0] */
+ int write_start; /* begining of data */
+};
+
+
+struct file *file_open(char *filename, int mode);
+int file_sync(struct file *file);
+int file_close(struct file *file);
+
+