- itojun@cvs.openbsd.org 2001/06/23 15:12:20
[auth1.c auth2.c auth2-chall.c authfd.c authfile.c auth-rhosts.c
canohost.c channels.c cipher.c clientloop.c deattack.c dh.c
hostfile.c kex.c kexdh.c kexgex.c key.c nchan.c packet.c radix.c
readpass.c scp.c servconf.c serverloop.c session.c sftp.c
sftp-client.c sftp-glob.c sftp-int.c sftp-server.c ssh-add.c
ssh-agent.c ssh.c sshconnect1.c sshconnect2.c sshconnect.c sshd.c
ssh-keygen.c ssh-keyscan.c]
more strict prototypes. raise warning level in Makefile.inc.
markus ok'ed
TODO; cleanup headers
diff --git a/sftp-server.c b/sftp-server.c
index ab6291e..e6353bc 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -22,7 +22,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
-RCSID("$OpenBSD: sftp-server.c,v 1.27 2001/06/22 22:21:20 markus Exp $");
+RCSID("$OpenBSD: sftp-server.c,v 1.28 2001/06/23 15:12:20 itojun Exp $");
#include "buffer.h"
#include "bufaux.h"
@@ -62,7 +62,7 @@
Attrib attrib;
};
-int
+static int
errno_to_portable(int unixerrno)
{
int ret = 0;
@@ -93,7 +93,7 @@
return ret;
}
-int
+static int
flags_from_portable(int pflags)
{
int flags = 0;
@@ -115,7 +115,7 @@
return flags;
}
-Attrib *
+static Attrib *
get_attrib(void)
{
return decode_attrib(&iqueue);
@@ -139,7 +139,7 @@
Handle handles[100];
-void
+static void
handle_init(void)
{
int i;
@@ -148,7 +148,7 @@
handles[i].use = HANDLE_UNUSED;
}
-int
+static int
handle_new(int use, char *name, int fd, DIR *dirp)
{
int i;
@@ -165,14 +165,14 @@
return -1;
}
-int
+static int
handle_is_ok(int i, int type)
{
return i >= 0 && i < sizeof(handles)/sizeof(Handle) &&
handles[i].use == type;
}
-int
+static int
handle_to_string(int handle, char **stringp, int *hlenp)
{
if (stringp == NULL || hlenp == NULL)
@@ -183,7 +183,7 @@
return 0;
}
-int
+static int
handle_from_string(char *handle, u_int hlen)
{
int val;
@@ -197,7 +197,7 @@
return -1;
}
-char *
+static char *
handle_to_name(int handle)
{
if (handle_is_ok(handle, HANDLE_DIR)||
@@ -206,7 +206,7 @@
return NULL;
}
-DIR *
+static DIR *
handle_to_dir(int handle)
{
if (handle_is_ok(handle, HANDLE_DIR))
@@ -214,7 +214,7 @@
return NULL;
}
-int
+static int
handle_to_fd(int handle)
{
if (handle_is_ok(handle, HANDLE_FILE))
@@ -222,7 +222,7 @@
return -1;
}
-int
+static int
handle_close(int handle)
{
int ret = -1;
@@ -239,7 +239,7 @@
return ret;
}
-int
+static int
get_handle(void)
{
char *handle;
@@ -255,7 +255,7 @@
/* send replies */
-void
+static void
send_msg(Buffer *m)
{
int mlen = buffer_len(m);
@@ -265,7 +265,7 @@
buffer_consume(m, mlen);
}
-void
+static void
send_status(u_int32_t id, u_int32_t error)
{
Buffer msg;
@@ -295,7 +295,7 @@
send_msg(&msg);
buffer_free(&msg);
}
-void
+static void
send_data_or_handle(char type, u_int32_t id, char *data, int dlen)
{
Buffer msg;
@@ -308,14 +308,14 @@
buffer_free(&msg);
}
-void
+static void
send_data(u_int32_t id, char *data, int dlen)
{
TRACE("sent data id %d len %d", id, dlen);
send_data_or_handle(SSH2_FXP_DATA, id, data, dlen);
}
-void
+static void
send_handle(u_int32_t id, int handle)
{
char *string;
@@ -327,7 +327,7 @@
xfree(string);
}
-void
+static void
send_names(u_int32_t id, int count, Stat *stats)
{
Buffer msg;
@@ -347,7 +347,7 @@
buffer_free(&msg);
}
-void
+static void
send_attrib(u_int32_t id, Attrib *a)
{
Buffer msg;
@@ -363,7 +363,7 @@
/* parse incoming */
-void
+static void
process_init(void)
{
Buffer msg;
@@ -377,7 +377,7 @@
buffer_free(&msg);
}
-void
+static void
process_open(void)
{
u_int32_t id, pflags;
@@ -409,7 +409,7 @@
xfree(name);
}
-void
+static void
process_close(void)
{
u_int32_t id;
@@ -423,7 +423,7 @@
send_status(id, status);
}
-void
+static void
process_read(void)
{
char buf[64*1024];
@@ -463,7 +463,7 @@
send_status(id, status);
}
-void
+static void
process_write(void)
{
u_int32_t id;
@@ -501,7 +501,7 @@
xfree(data);
}
-void
+static void
process_do_stat(int do_lstat)
{
Attrib a;
@@ -526,19 +526,19 @@
xfree(name);
}
-void
+static void
process_stat(void)
{
process_do_stat(0);
}
-void
+static void
process_lstat(void)
{
process_do_stat(1);
}
-void
+static void
process_fstat(void)
{
Attrib a;
@@ -564,7 +564,7 @@
send_status(id, status);
}
-struct timeval *
+static struct timeval *
attrib_to_tv(Attrib *a)
{
static struct timeval tv[2];
@@ -576,7 +576,7 @@
return tv;
}
-void
+static void
process_setstat(void)
{
Attrib *a;
@@ -608,7 +608,7 @@
xfree(name);
}
-void
+static void
process_fsetstat(void)
{
Attrib *a;
@@ -657,7 +657,7 @@
send_status(id, status);
}
-void
+static void
process_opendir(void)
{
DIR *dirp = NULL;
@@ -689,7 +689,7 @@
/*
* drwxr-xr-x 5 markus markus 1024 Jan 13 18:39 .ssh
*/
-char *
+static char *
ls_file(char *name, struct stat *st)
{
int ulen, glen, sz = 0;
@@ -728,7 +728,7 @@
return xstrdup(buf);
}
-void
+static void
process_readdir(void)
{
DIR *dirp;
@@ -782,7 +782,7 @@
}
}
-void
+static void
process_remove(void)
{
char *name;
@@ -799,7 +799,7 @@
xfree(name);
}
-void
+static void
process_mkdir(void)
{
Attrib *a;
@@ -819,7 +819,7 @@
xfree(name);
}
-void
+static void
process_rmdir(void)
{
u_int32_t id;
@@ -835,7 +835,7 @@
xfree(name);
}
-void
+static void
process_realpath(void)
{
char resolvedname[MAXPATHLEN];
@@ -860,7 +860,7 @@
xfree(path);
}
-void
+static void
process_rename(void)
{
u_int32_t id;
@@ -882,7 +882,7 @@
xfree(newpath);
}
-void
+static void
process_readlink(void)
{
u_int32_t id;
@@ -906,7 +906,7 @@
xfree(path);
}
-void
+static void
process_symlink(void)
{
u_int32_t id;
@@ -928,7 +928,7 @@
xfree(newpath);
}
-void
+static void
process_extended(void)
{
u_int32_t id;
@@ -942,7 +942,7 @@
/* stolen from ssh-agent */
-void
+static void
process(void)
{
u_int msg_len;