repo sync
This commit is contained in:
parent
ea98d0548c
commit
cc9b9164b3
14
BETA.README
14
BETA.README
|
|
@ -9,13 +9,15 @@ FSP Development Battle plan:
|
||||||
============================
|
============================
|
||||||
|
|
||||||
2.8.2 - Next Stable version after 10 years or so
|
2.8.2 - Next Stable version after 10 years or so
|
||||||
- get out this version as soon as possible. 2.8.1b3 and lower are buggy.
|
FSP Protocol wire changes:
|
||||||
- add FSP Rename command
|
|
||||||
- add FSP Info command
|
- add FSP Info command
|
||||||
- resolve symlink support problem. This maybe breaks compatibility
|
- resolve symlink support problem. This maybe breaks compatibility
|
||||||
with older software versions.
|
with older software versions.
|
||||||
- security: symlink to FILE can escape from FSP root directory.
|
- security: symlink to FILE can escape from FSP root directory, this will
|
||||||
- fix Sven's Slowaris 8 compile problem
|
be fixed as part of symlink support.
|
||||||
|
- add FSP change password command (??)
|
||||||
|
Code fixups:
|
||||||
|
- fix Sven's compiling problems on various unixes
|
||||||
- normalize return error codes of all clients
|
- normalize return error codes of all clients
|
||||||
- server can be run multiple times on the same port, how to check?
|
- server can be run multiple times on the same port, how to check?
|
||||||
on freebsd this works okay. needs re-testing on linux.
|
on freebsd this works okay. needs re-testing on linux.
|
||||||
|
|
@ -24,9 +26,7 @@ FSP Development Battle plan:
|
||||||
* for next point Stable version 2.8.3
|
* for next point Stable version 2.8.3
|
||||||
- retune alg. for links with high packet loss
|
- retune alg. for links with high packet loss
|
||||||
- hard coded access list, do not load it from filesystem
|
- hard coded access list, do not load it from filesystem
|
||||||
- add FSP change password command
|
- support for ~user namespace
|
||||||
- add FSP command for changing owners
|
|
||||||
- add FSP command for listing directory owners
|
|
||||||
|
|
||||||
FSP V2.8.1 Beta version Notes:
|
FSP V2.8.1 Beta version Notes:
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
|
||||||
32
ChangeLog
32
ChangeLog
|
|
@ -1,3 +1,35 @@
|
||||||
|
version 2.8.1b21 - 1 Nov 2004
|
||||||
|
check for errors while copying files in fspd.
|
||||||
|
removed all the PROTOX macros junk. Tools for analyzing C source
|
||||||
|
code works with fsp codebase now as result.
|
||||||
|
added rename command
|
||||||
|
add fmvcmd client for renaming files
|
||||||
|
reorder some checks in configure.ac
|
||||||
|
added one testcase to the path test suite
|
||||||
|
client library did not sended any passwords to server
|
||||||
|
util_abs_path now appends \npassword to full path
|
||||||
|
server do not send correctly \0 terminated directory readmes
|
||||||
|
PROTOCOL: Added information about optionally large sized packets,
|
||||||
|
transport and information about FSP project URL.
|
||||||
|
PROTOCOL: checked/repaired by ispell :)
|
||||||
|
PROTOCOL: added more details about packet checksuming.
|
||||||
|
Lamerpack: removed port 21 from list of recommended ports.
|
||||||
|
Lamerpack: avoid easy detection by lamers by disabling ver command
|
||||||
|
do not print password to stdout in fcdcmd
|
||||||
|
PROTOCOL: Add note to clients writers that two replies from server
|
||||||
|
can contain extra data even if server is not able to handle extra
|
||||||
|
data packets on input.
|
||||||
|
FreeBSD needs /usr/local/lib in LDFLAGS to make Electric Fence
|
||||||
|
correctly detected by autotools
|
||||||
|
PROTOCOL: define 5th bit in version flags - support for xtra data
|
||||||
|
on input
|
||||||
|
server.c: send accept xtra data flag set
|
||||||
|
fver: print difference between max. supported payload and
|
||||||
|
preffered payload size
|
||||||
|
when directory has no readme, do not send any regular data block
|
||||||
|
at all. Previous versions sends one null byte
|
||||||
|
printpro.c - print readme only if nonzero sized
|
||||||
|
|
||||||
version 2.8.1b20 - 26 Oct 2004
|
version 2.8.1b20 - 26 Oct 2004
|
||||||
Added pidfile.[c|h] from FreeBSD and modified it to fit in (hoaxter)
|
Added pidfile.[c|h] from FreeBSD and modified it to fit in (hoaxter)
|
||||||
Added pidfile support, config option is 'pidlogname' (hoaxter)
|
Added pidfile support, config option is 'pidlogname' (hoaxter)
|
||||||
|
|
|
||||||
2
FILES
2
FILES
|
|
@ -5,7 +5,7 @@ Complete content of the FSP package:
|
||||||
FILES This list.
|
FILES This list.
|
||||||
INFO Information about the purpose of FSP
|
INFO Information about the purpose of FSP
|
||||||
INSTALL Installation instructions for FSP
|
INSTALL Installation instructions for FSP
|
||||||
PROTOCOL Unofficial FSP protocol definition
|
PROTOCOL FSP protocol definition
|
||||||
MACHINES Where FSP compiles out of box
|
MACHINES Where FSP compiles out of box
|
||||||
faq.html FSP FAQ
|
faq.html FSP FAQ
|
||||||
Makefile.in input file for building makefile from configure script.
|
Makefile.in input file for building makefile from configure script.
|
||||||
|
|
|
||||||
68
TODO
68
TODO
|
|
@ -2,9 +2,10 @@ FSP SUITE TO DO LIST BY RADIM KOLAR
|
||||||
/* maintained by hsn -at- netmag * cz */
|
/* maintained by hsn -at- netmag * cz */
|
||||||
|
|
||||||
Radim Kolar's personal wishlist from 1997
|
Radim Kolar's personal wishlist from 1997
|
||||||
show loosers online (finfo command) and server statz
|
*-high priority-*
|
||||||
rename command
|
- show loosers online (finfo command) and server statz
|
||||||
password change command
|
* l o w *
|
||||||
|
- password change command
|
||||||
|
|
||||||
TESTSUITE NEEDED:
|
TESTSUITE NEEDED:
|
||||||
Write a simple FSP protocol testing tool
|
Write a simple FSP protocol testing tool
|
||||||
|
|
@ -15,36 +16,42 @@ Test new command rename /when implemented/
|
||||||
|
|
||||||
SECURITY BUGS:
|
SECURITY BUGS:
|
||||||
symlink to FILE can escape from FSP root directory. OLD known problem.
|
symlink to FILE can escape from FSP root directory. OLD known problem.
|
||||||
|
symlink support must be reworked before final release.
|
||||||
|
|
||||||
PROTOCOL-RELATED BUGS:
|
PROTOCOL-RELATED BUGS:
|
||||||
it is not clear how to generate directory items with type skip. append
|
fprocmd/fcdcmd do not support embedded servers correctly
|
||||||
\0 name to them or not? All known clients stops reading the directory
|
|
||||||
when sees skip item in block.
|
|
||||||
|
|
||||||
PORTING
|
PORTING
|
||||||
Sven's Slowaris 8 compile problem
|
Sven's Slowaris 8 compile problem
|
||||||
not builds on freebsd 4 and non intel platforms?
|
Sven's AIX compile problem
|
||||||
|
not builds on freebsd 4 and FreeBSD 5 - non intel platforms?
|
||||||
|
|
||||||
NEEDS IMPROVMENT:
|
NEEDS IMPROVMENT:
|
||||||
|
|
||||||
Client LIBRARY
|
Client LIBRARY
|
||||||
:high:
|
:high:
|
||||||
we should retune retry algoritm for better support lines with higher
|
we should retune retry algoritm for better support lines with higher
|
||||||
packed loss.
|
packed loss. On common internet lines current one works okay.
|
||||||
add more detailed stats from retry alg.
|
add more detailed stats from retry alg.
|
||||||
:low:
|
:low:
|
||||||
fver and others add support new syntax fsp://host:port/file
|
fver and others add support new syntax fsp://host:port/file
|
||||||
add sem locking method, possible?
|
add sem locking method, possible?
|
||||||
flscmd does stat before directory listing, why?
|
flscmd should not to do stat before directory listing.
|
||||||
|
directory listing should not need to get 0 sized block. Needs total code
|
||||||
|
rewrite.
|
||||||
|
better support for persistent keys - do not send cc_bye ? this should
|
||||||
|
be probably configurable
|
||||||
|
|
||||||
:long-term goals:
|
:long-term goals:
|
||||||
:better to write a new code instead fixing old crap
|
:better to write a new code instead of fixing 10 yo crap.
|
||||||
=convert to multi threaded=
|
=convert to multi threaded=
|
||||||
make setup from env a separate function
|
make setup from env a separate function
|
||||||
do not use global variables
|
do not use global variables
|
||||||
|
|
||||||
CLIENTS
|
CLIENTS
|
||||||
ALL: normalize return error codes of all clients
|
:high:
|
||||||
write new clients for new commands - fsprencmd fpasswd finfo
|
normalize return error codes of all clients
|
||||||
|
write new clients for new commands - fpasswd finfo
|
||||||
:low:
|
:low:
|
||||||
add support for more sane fsplist file format (as used by warez
|
add support for more sane fsplist file format (as used by warez
|
||||||
ppl) to fhostcmd
|
ppl) to fhostcmd
|
||||||
|
|
@ -57,35 +64,43 @@ clients do not freeing memory allocated from glob()
|
||||||
FUTURE FEATURES FOR SERVER:
|
FUTURE FEATURES FOR SERVER:
|
||||||
:high: required for 2.8.2 final
|
:high: required for 2.8.2 final
|
||||||
can be run multiple times on the same port, how to check?
|
can be run multiple times on the same port, how to check?
|
||||||
Currently looks fine on bsd.
|
drop reuse flag from socket bind?
|
||||||
write RENAME FSP command
|
Currently looks fine with flag on bsd. Fails on lin-suck.
|
||||||
|
|
||||||
report number of clients connected, size of hostable in new command
|
report number of clients connected, size of hostable in new command
|
||||||
CC_INFO command
|
CC_INFO command
|
||||||
special defence against rapid/double fire clients (burst command in fspclient)
|
special defence against rapid/double fire clients (burst command in fspclient)
|
||||||
|
|
||||||
:midle:may not be in 2.8.2
|
|
||||||
Native Supports for symbolic links (needed for mirroring Debian)
|
Native Supports for symbolic links (needed for mirroring Debian)
|
||||||
|
new LSTAT COMMAND
|
||||||
write FSP_CHANGE_PASSWORD command
|
write FSP_CHANGE_PASSWORD command
|
||||||
|
|
||||||
|
:midle:may not be in 2.8.2
|
||||||
|
improve RENAME FSP command
|
||||||
|
* cross directory renames are unsuported for now
|
||||||
|
* server can send error reply even to denied per directory clients
|
||||||
|
- minor security flaw
|
||||||
|
|
||||||
:low:this will sure go after 2.8.2:
|
:low:this will sure go after 2.8.2:
|
||||||
FSP_GET/SET OWNERS like file transfer
|
hashed passwords. Do we really needs them?
|
||||||
hashed passwords
|
add switch for directory vs global ACL overide
|
||||||
add switch for dir vs global access priority, override table
|
hard code acl into server configuration, do not use .FSP_ filez.
|
||||||
use ntons a podobne funkce v iprange.c
|
|
||||||
pouzivat nejaky jiny typ nez unsigned long pro ip adresu
|
|
||||||
hard coded directory access rights in configuration instead of loading from FS
|
|
||||||
support for user directory namespace ~hsn / public_html, check links to outside!
|
support for user directory namespace ~hsn / public_html, check links to outside!
|
||||||
|
use ntons a podobne funkce v iprange.c
|
||||||
|
ipv6 socket support
|
||||||
privileged Hosts, excluded from Byte transfer Limit (hard to do)
|
privileged Hosts, excluded from Byte transfer Limit (hard to do)
|
||||||
FSP Proxy repeater
|
|
||||||
|
new toy
|
||||||
|
FSP Proxy repeater - look at old code.
|
||||||
|
|
||||||
PERFORMANCE:
|
PERFORMANCE:
|
||||||
host hashtable shrinking sometimes
|
host hashtable shrinking sometimes
|
||||||
stat cache pro FSP_STAT a ostatni
|
stat cache pro FSP_STAT a ostatni staty
|
||||||
|
chage O(N) fifo cache to some more sane lru hashtable code.
|
||||||
background time() alarm() caller
|
background time() alarm() caller
|
||||||
Current performance 1925648B/s
|
Current performance 1925648B/s
|
||||||
|
|
||||||
MAN:
|
MAN:
|
||||||
update FAQ - urgent!!
|
finish sgml FAQ
|
||||||
separate manpage for 7 fsp (protocol definition) == write FSP RFC
|
separate manpage for 7 fsp (protocol definition) == write FSP RFC
|
||||||
|
|
||||||
libraries and support for FSP protocol
|
libraries and support for FSP protocol
|
||||||
|
|
@ -93,9 +108,10 @@ libraries and support for FSP protocol
|
||||||
|
|
||||||
DONE: FSP library for Java
|
DONE: FSP library for Java
|
||||||
DONE: FSP over HTTP
|
DONE: FSP over HTTP
|
||||||
|
FSP plugin do Netscape/MSIE. Not possible to write protocol plugins?
|
||||||
|
we have fsproxy now.
|
||||||
WIP: new small,light fsplib for C.
|
WIP: new small,light fsplib for C.
|
||||||
FSP backend for APT
|
FSP backend for APT
|
||||||
FSP plugin do Netscape/MSIE
|
|
||||||
Transfer HTTP over fsp transport
|
Transfer HTTP over fsp transport
|
||||||
FSP support to lftp,wget,curl
|
FSP support to lftp,wget,curl
|
||||||
AVFS plugin http://sourceforge.net/projects/avf
|
AVFS plugin http://sourceforge.net/projects/avf
|
||||||
|
|
|
||||||
33
autogen.sh
33
autogen.sh
|
|
@ -8,10 +8,6 @@
|
||||||
#
|
#
|
||||||
# Radim Kolar
|
# Radim Kolar
|
||||||
#
|
#
|
||||||
# TODO: add linux support (sven?)
|
|
||||||
# add detection of automake19 and use it instead of
|
|
||||||
# automake18
|
|
||||||
#
|
|
||||||
rm -f configure configure.lineno config.log config.status
|
rm -f configure configure.lineno config.log config.status
|
||||||
rm -f aclocal.m4
|
rm -f aclocal.m4
|
||||||
#rm -fr autom4te.cache
|
#rm -fr autom4te.cache
|
||||||
|
|
@ -19,19 +15,32 @@ rm -f Makefile "Makefile.in"
|
||||||
echo "Generating configure and friends..."
|
echo "Generating configure and friends..."
|
||||||
if [ `uname -s` = 'FreeBSD' ]; then
|
if [ `uname -s` = 'FreeBSD' ]; then
|
||||||
echo "* FreeBSD detected"
|
echo "* FreeBSD detected"
|
||||||
echo "* Using autoconf 2.59 + automake 1.8"
|
echo "* Using autoconf 2.59"
|
||||||
#Use autoconf 2.59 + automake 1.8 pair
|
if [ -x /usr/local/bin/automake18 ]; then
|
||||||
ACLOCAL=aclocal18; export ACLOCAL
|
echo "* Using automake 1.8"
|
||||||
AUTOMAKE=automake18; export AUTOMAKE
|
ACLOCAL=aclocal18; export ACLOCAL
|
||||||
|
AUTOMAKE=automake18; export AUTOMAKE
|
||||||
|
else
|
||||||
|
echo "* Using automake 1.9"
|
||||||
|
ACLOCAL=aclocal19; export ACLOCAL
|
||||||
|
AUTOMAKE=automake19; export AUTOMAKE
|
||||||
|
fi
|
||||||
|
#Use autoconf 2.59 + automake 1.X pair
|
||||||
AUTOHEADER=autoheader259; export AUTOHEADER
|
AUTOHEADER=autoheader259; export AUTOHEADER
|
||||||
AUTOCONF=autoconf259; export AUTOCONF
|
AUTOCONF=autoconf259; export AUTOCONF
|
||||||
autoreconf259 -v
|
export LDFLAGS=-L/usr/local/lib
|
||||||
|
autoreconf259 -iv
|
||||||
else
|
else
|
||||||
echo "Using your default auto* tools"
|
echo "Using your default auto* tools"
|
||||||
#this should work with recent autotools
|
#this should work with recent autotools
|
||||||
autoreconf -iv
|
autoreconf -iv
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Now running configure $@"
|
if [ $# -eq 0 ]; then
|
||||||
./configure $@
|
echo "Now running configure in maintainer mode"
|
||||||
echo "done."
|
./configure --enable-maintainer-mode
|
||||||
|
else
|
||||||
|
echo "Now running configure $@"
|
||||||
|
./configure $@
|
||||||
|
fi;
|
||||||
|
echo "$0 done."
|
||||||
|
|
|
||||||
|
|
@ -26,42 +26,42 @@
|
||||||
#include "ls.h"
|
#include "ls.h"
|
||||||
#include "my-string.h"
|
#include "my-string.h"
|
||||||
|
|
||||||
int namecmp PROTO2(LS *, a, LS *, b)
|
int namecmp (LS * a, LS * b)
|
||||||
{
|
{
|
||||||
return(strcmp(a->name, b->name));
|
return(strcmp(a->name, b->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
int revnamecmp PROTO2(LS *, a, LS *, b)
|
int revnamecmp (LS * a, LS * b)
|
||||||
{
|
{
|
||||||
return(strcmp(b->name, a->name));
|
return(strcmp(b->name, a->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
int modcmp PROTO2(LS *, a, LS *, b)
|
int modcmp (LS * a, LS * b)
|
||||||
{
|
{
|
||||||
return(-(int)(a->lstat.st_mtime - b->lstat.st_mtime));
|
return(-(int)(a->lstat.st_mtime - b->lstat.st_mtime));
|
||||||
}
|
}
|
||||||
|
|
||||||
int revmodcmp PROTO2(LS *, a, LS *, b)
|
int revmodcmp (LS * a, LS * b)
|
||||||
{
|
{
|
||||||
return(-(int)(b->lstat.st_mtime - a->lstat.st_mtime));
|
return(-(int)(b->lstat.st_mtime - a->lstat.st_mtime));
|
||||||
}
|
}
|
||||||
|
|
||||||
int acccmp PROTO2(LS *, a, LS *, b)
|
int acccmp (LS * a, LS * b)
|
||||||
{
|
{
|
||||||
return(-(int)(a->lstat.st_atime - b->lstat.st_atime));
|
return(-(int)(a->lstat.st_atime - b->lstat.st_atime));
|
||||||
}
|
}
|
||||||
|
|
||||||
int revacccmp PROTO2(LS *, a, LS *, b)
|
int revacccmp (LS * a, LS * b)
|
||||||
{
|
{
|
||||||
return(-(int)(b->lstat.st_atime - a->lstat.st_atime));
|
return(-(int)(b->lstat.st_atime - a->lstat.st_atime));
|
||||||
}
|
}
|
||||||
|
|
||||||
int statcmp PROTO2(LS *, a, LS *, b)
|
int statcmp (LS * a, LS * b)
|
||||||
{
|
{
|
||||||
return(-(int)(a->lstat.st_ctime - b->lstat.st_ctime));
|
return(-(int)(a->lstat.st_ctime - b->lstat.st_ctime));
|
||||||
}
|
}
|
||||||
|
|
||||||
int revstatcmp PROTO2(LS *, a, LS *, b)
|
int revstatcmp (LS * a, LS * b)
|
||||||
{
|
{
|
||||||
return(-(int)(b->lstat.st_ctime - a->lstat.st_ctime));
|
return(-(int)(b->lstat.st_ctime - a->lstat.st_ctime));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ PLAN *plan;
|
||||||
* command arguments.
|
* command arguments.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void find_formplan PROTO1(char **, argv)
|
void find_formplan (char ** argv)
|
||||||
{
|
{
|
||||||
PLAN *tail = NULL, *new = NULL;
|
PLAN *tail = NULL, *new = NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
#define EOS '\0'
|
#define EOS '\0'
|
||||||
|
|
||||||
static char *rangematch PROTO2(register char *, pattern, register char, test)
|
static char *rangematch (register char * pattern, register char test)
|
||||||
{
|
{
|
||||||
register char c, c2;
|
register char c, c2;
|
||||||
int negate, ok;
|
int negate, ok;
|
||||||
|
|
@ -72,7 +72,7 @@ static char *rangematch PROTO2(register char *, pattern, register char, test)
|
||||||
return(ok == negate ? NULL : pattern);
|
return(ok == negate ? NULL : pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fnmatch PROTO2(register char *, pattern, register char *, string)
|
int fnmatch (register char * pattern, register char * string)
|
||||||
{
|
{
|
||||||
register char c;
|
register char c;
|
||||||
char test;
|
char test;
|
||||||
|
|
|
||||||
|
|
@ -100,13 +100,7 @@
|
||||||
return(0); \
|
return(0); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PROTOTYPES
|
|
||||||
static PLAN *palloc (enum ntype t, int (*f)())
|
static PLAN *palloc (enum ntype t, int (*f)())
|
||||||
#else
|
|
||||||
static PLAN *palloc (t, f)
|
|
||||||
enum ntype t;
|
|
||||||
int (*f)();
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
PLAN *new;
|
PLAN *new;
|
||||||
|
|
||||||
|
|
@ -130,8 +124,8 @@ extern int process;
|
||||||
* find_parsenum --
|
* find_parsenum --
|
||||||
* Parse a string of the form [+-]# and return the value.
|
* Parse a string of the form [+-]# and return the value.
|
||||||
*/
|
*/
|
||||||
static long find_parsenum PROTO4(PLAN *, plan, const char *, option, char *, str,
|
static long find_parsenum (PLAN * plan, const char * option, char * str,
|
||||||
char *, endch)
|
char * endch)
|
||||||
{
|
{
|
||||||
long value;
|
long value;
|
||||||
char *endchar; /* pointer to character ending conversion */
|
char *endchar; /* pointer to character ending conversion */
|
||||||
|
|
@ -176,7 +170,7 @@ static long find_parsenum PROTO4(PLAN *, plan, const char *, option, char *, str
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern time_t now;
|
extern time_t now;
|
||||||
static int find_time PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
static int find_time (PLAN * plan, struct stat * sbuf, char * path)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* with FSP sbuf.st_atime=sbuf.st_ctime=sbuf.st_mtime */
|
/* with FSP sbuf.st_atime=sbuf.st_ctime=sbuf.st_mtime */
|
||||||
|
|
@ -184,7 +178,7 @@ static int find_time PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PLAN * c_time PROTO1(char *, arg)
|
PLAN * c_time (char * arg)
|
||||||
{
|
{
|
||||||
PLAN *new;
|
PLAN *new;
|
||||||
|
|
||||||
|
|
@ -197,7 +191,7 @@ PLAN * c_time PROTO1(char *, arg)
|
||||||
* brace_subst --
|
* brace_subst --
|
||||||
* Replace occurrences of {} in s1 with s2 and return the result string.
|
* Replace occurrences of {} in s1 with s2 and return the result string.
|
||||||
*/
|
*/
|
||||||
static void brace_subst PROTO4(char *, orig, char **, store, char *, path, int,len)
|
static void brace_subst (char * orig, char ** store, char * path, int len)
|
||||||
{
|
{
|
||||||
register int plen;
|
register int plen;
|
||||||
register char ch, *p;
|
register char ch, *p;
|
||||||
|
|
@ -224,7 +218,7 @@ static void brace_subst PROTO4(char *, orig, char **, store, char *, path, int,l
|
||||||
* print a message to standard error and then read input from standard
|
* print a message to standard error and then read input from standard
|
||||||
* input. If the input is 'y' then 1 is returned.
|
* input. If the input is 'y' then 1 is returned.
|
||||||
*/
|
*/
|
||||||
static int queryuser PROTO1(char **, argv)
|
static int queryuser (char ** argv)
|
||||||
{
|
{
|
||||||
int ch, first, nl;
|
int ch, first, nl;
|
||||||
|
|
||||||
|
|
@ -264,7 +258,7 @@ static int queryuser PROTO1(char **, argv)
|
||||||
* The primary -ok is different in that it requests affirmation of the
|
* The primary -ok is different in that it requests affirmation of the
|
||||||
* user before executing the utility.
|
* user before executing the utility.
|
||||||
*/
|
*/
|
||||||
static int find_exec PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
static int find_exec (PLAN * plan, struct stat * sbuf, char * path)
|
||||||
{
|
{
|
||||||
register int cnt;
|
register int cnt;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
@ -296,7 +290,7 @@ static int find_exec PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
||||||
return(pid != -1 && WIFEXITED(status) && !WEXITSTATUS(status));
|
return(pid != -1 && WIFEXITED(status) && !WEXITSTATUS(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *emalloc_ffind PROTO1(unsigned int, len)
|
static char *emalloc_ffind (unsigned int len)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
|
@ -312,7 +306,7 @@ static char *emalloc_ffind PROTO1(unsigned int, len)
|
||||||
* argv array, and one with integer values that are lengths of the
|
* argv array, and one with integer values that are lengths of the
|
||||||
* strings, but also flags meaning that the string has to be massaged.
|
* strings, but also flags meaning that the string has to be massaged.
|
||||||
*/
|
*/
|
||||||
PLAN *c_exec PROTO2(char ***, argvp, int, isok)
|
PLAN *c_exec (char *** argvp, int isok)
|
||||||
{
|
{
|
||||||
PLAN *new; /* node returned */
|
PLAN *new; /* node returned */
|
||||||
register int cnt;
|
register int cnt;
|
||||||
|
|
@ -355,12 +349,12 @@ PLAN *c_exec PROTO2(char ***, argvp, int, isok)
|
||||||
return(new);
|
return(new);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printtime_ffind PROTO1(time_t, ftime)
|
static void printtime_ffind (time_t ftime)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *longstring;
|
char *longstring;
|
||||||
|
|
||||||
longstring = (char *)ctime((long *)&ftime);
|
longstring = (char *)ctime(&ftime);
|
||||||
for (i = 4; i < 11; ++i) putchar(longstring[i]);
|
for (i = 4; i < 11; ++i) putchar(longstring[i]);
|
||||||
|
|
||||||
#define SIXMONTHS ((DAYSPERNYEAR / 2) * SECSPERDAY)
|
#define SIXMONTHS ((DAYSPERNYEAR / 2) * SECSPERDAY)
|
||||||
|
|
@ -376,7 +370,7 @@ static void printtime_ffind PROTO1(time_t, ftime)
|
||||||
|
|
||||||
#define BLK(A) (((A)+1023)/1024)
|
#define BLK(A) (((A)+1023)/1024)
|
||||||
|
|
||||||
static void printlong_ffind PROTO2(char *, name, struct stat *, sb)
|
static void printlong_ffind (char * name, struct stat * sb)
|
||||||
{
|
{
|
||||||
const char *modep;
|
const char *modep;
|
||||||
|
|
||||||
|
|
@ -395,13 +389,13 @@ static void printlong_ffind PROTO2(char *, name, struct stat *, sb)
|
||||||
*
|
*
|
||||||
* Always true - prints the current sbuf to stdout in "ls" format.
|
* Always true - prints the current sbuf to stdout in "ls" format.
|
||||||
*/
|
*/
|
||||||
static int find_ls PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
static int find_ls (PLAN * plan, struct stat * sbuf, char * path)
|
||||||
{
|
{
|
||||||
printlong_ffind(path, sbuf);
|
printlong_ffind(path, sbuf);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAN *c_ls PROTO0((void))
|
PLAN *c_ls (void)
|
||||||
{
|
{
|
||||||
isoutput = 1;
|
isoutput = 1;
|
||||||
return(palloc(N_LS, find_ls));
|
return(palloc(N_LS, find_ls));
|
||||||
|
|
@ -413,7 +407,7 @@ PLAN *c_ls PROTO0((void))
|
||||||
* True if the basename of the filename being examined
|
* True if the basename of the filename being examined
|
||||||
* matches pattern using Pattern Matching Notation S3.14
|
* matches pattern using Pattern Matching Notation S3.14
|
||||||
*/
|
*/
|
||||||
static int find_name PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
static int find_name (PLAN * plan, struct stat * sbuf, char * path)
|
||||||
{
|
{
|
||||||
register char *name;
|
register char *name;
|
||||||
|
|
||||||
|
|
@ -423,7 +417,7 @@ static int find_name PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
||||||
return(fnmatch(plan->c_data, name));
|
return(fnmatch(plan->c_data, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAN *c_name PROTO1(char *, pattern)
|
PLAN *c_name (char * pattern)
|
||||||
{
|
{
|
||||||
PLAN *new;
|
PLAN *new;
|
||||||
|
|
||||||
|
|
@ -439,12 +433,12 @@ PLAN *c_name PROTO1(char *, pattern)
|
||||||
* then the modification time of the file named by the pathname
|
* then the modification time of the file named by the pathname
|
||||||
* file.
|
* file.
|
||||||
*/
|
*/
|
||||||
static int find_newer PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
static int find_newer (PLAN * plan, struct stat * sbuf, char * path)
|
||||||
{
|
{
|
||||||
return(sbuf->st_mtime > plan->t_data);
|
return(sbuf->st_mtime > plan->t_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAN *c_newer PROTO1(char *, filename)
|
PLAN *c_newer (char * filename)
|
||||||
{
|
{
|
||||||
PLAN *new;
|
PLAN *new;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
@ -464,13 +458,13 @@ PLAN *c_newer PROTO1(char *, filename)
|
||||||
* Always true, causes the current pathame to be written to
|
* Always true, causes the current pathame to be written to
|
||||||
* standard output.
|
* standard output.
|
||||||
*/
|
*/
|
||||||
static int find_print PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
static int find_print (PLAN * plan, struct stat * sbuf, char * path)
|
||||||
{
|
{
|
||||||
(void)printf("%s\n", path);
|
(void)printf("%s\n", path);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAN *c_print PROTO0((void))
|
PLAN *c_print (void)
|
||||||
{
|
{
|
||||||
isoutput = 1;
|
isoutput = 1;
|
||||||
|
|
||||||
|
|
@ -482,13 +476,13 @@ PLAN *c_print PROTO0((void))
|
||||||
*
|
*
|
||||||
* Prune a portion of the hierarchy.
|
* Prune a portion of the hierarchy.
|
||||||
*/
|
*/
|
||||||
static int find_prune PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
static int find_prune (PLAN * plan, struct stat * sbuf, char * path)
|
||||||
{
|
{
|
||||||
process = -1;
|
process = -1;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAN *c_prune PROTO0((void))
|
PLAN *c_prune (void)
|
||||||
{
|
{
|
||||||
return(palloc(N_PRUNE, find_prune));
|
return(palloc(N_PRUNE, find_prune));
|
||||||
}
|
}
|
||||||
|
|
@ -503,7 +497,7 @@ PLAN *c_prune PROTO0((void))
|
||||||
#define FIND_SIZE 512
|
#define FIND_SIZE 512
|
||||||
static int divsize = 1;
|
static int divsize = 1;
|
||||||
|
|
||||||
static int find_size PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
static int find_size (PLAN * plan, struct stat * sbuf, char * path)
|
||||||
{
|
{
|
||||||
off_t size;
|
off_t size;
|
||||||
|
|
||||||
|
|
@ -511,7 +505,7 @@ static int find_size PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
||||||
COMPARE(size, plan->o_data);
|
COMPARE(size, plan->o_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAN *c_size PROTO1(char *, arg)
|
PLAN *c_size (char * arg)
|
||||||
{
|
{
|
||||||
PLAN *new;
|
PLAN *new;
|
||||||
char endch='c';
|
char endch='c';
|
||||||
|
|
@ -528,12 +522,12 @@ PLAN *c_size PROTO1(char *, arg)
|
||||||
* True if the type of the file is c, where c is d or f for
|
* True if the type of the file is c, where c is d or f for
|
||||||
* directory or regular file, respectively.
|
* directory or regular file, respectively.
|
||||||
*/
|
*/
|
||||||
static int find_type PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
static int find_type (PLAN * plan, struct stat * sbuf, char * path)
|
||||||
{
|
{
|
||||||
return((sbuf->st_mode & S_IFMT) == plan->m_data);
|
return((sbuf->st_mode & S_IFMT) == plan->m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAN *c_type PROTO1(char *, typestring)
|
PLAN *c_type (char * typestring)
|
||||||
{
|
{
|
||||||
PLAN *new;
|
PLAN *new;
|
||||||
mode_t mask;
|
mode_t mask;
|
||||||
|
|
@ -560,7 +554,7 @@ PLAN *c_type PROTO1(char *, typestring)
|
||||||
*
|
*
|
||||||
* True if expression is true.
|
* True if expression is true.
|
||||||
*/
|
*/
|
||||||
int find_expr PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
int find_expr (PLAN * plan, struct stat * sbuf, char * path)
|
||||||
{
|
{
|
||||||
register PLAN *p;
|
register PLAN *p;
|
||||||
register int state;
|
register int state;
|
||||||
|
|
@ -574,12 +568,12 @@ int find_expr PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
||||||
* eliminated during phase 2 of find_formplan() --- the '(' node is converted
|
* eliminated during phase 2 of find_formplan() --- the '(' node is converted
|
||||||
* to a N_EXPR node containing the expression and the ')' node is discarded.
|
* to a N_EXPR node containing the expression and the ')' node is discarded.
|
||||||
*/
|
*/
|
||||||
PLAN *c_openparen PROTO0((void))
|
PLAN *c_openparen (void)
|
||||||
{
|
{
|
||||||
return(palloc(N_OPENPAREN, (int (*)())-1));
|
return(palloc(N_OPENPAREN, (int (*)())-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAN *c_closeparen PROTO0((void))
|
PLAN *c_closeparen (void)
|
||||||
{
|
{
|
||||||
return(palloc(N_CLOSEPAREN, (int (*)())-1));
|
return(palloc(N_CLOSEPAREN, (int (*)())-1));
|
||||||
}
|
}
|
||||||
|
|
@ -590,7 +584,7 @@ PLAN *c_closeparen PROTO0((void))
|
||||||
*
|
*
|
||||||
* Negation of a primary; the unary NOT operator.
|
* Negation of a primary; the unary NOT operator.
|
||||||
*/
|
*/
|
||||||
static int find_not PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
static int find_not (PLAN * plan, struct stat * sbuf, char * path)
|
||||||
{
|
{
|
||||||
register PLAN *p;
|
register PLAN *p;
|
||||||
register int state;
|
register int state;
|
||||||
|
|
@ -599,7 +593,7 @@ static int find_not PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
||||||
return(!state);
|
return(!state);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAN *c_not PROTO0((void))
|
PLAN *c_not (void)
|
||||||
{
|
{
|
||||||
return(palloc(N_NOT, find_not));
|
return(palloc(N_NOT, find_not));
|
||||||
}
|
}
|
||||||
|
|
@ -610,7 +604,7 @@ PLAN *c_not PROTO0((void))
|
||||||
* Alternation of primaries; the OR operator. The second expression is
|
* Alternation of primaries; the OR operator. The second expression is
|
||||||
* not evaluated if the first expression is true.
|
* not evaluated if the first expression is true.
|
||||||
*/
|
*/
|
||||||
static int find_or PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
static int find_or (PLAN * plan, struct stat * sbuf, char * path)
|
||||||
{
|
{
|
||||||
register PLAN *p;
|
register PLAN *p;
|
||||||
register int state;
|
register int state;
|
||||||
|
|
@ -623,7 +617,7 @@ static int find_or PROTO3(PLAN *, plan, struct stat *, sbuf, char *, path)
|
||||||
return(state);
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAN *c_or PROTO0((void))
|
PLAN *c_or (void)
|
||||||
{
|
{
|
||||||
return(palloc(N_OR, find_or));
|
return(palloc(N_OR, find_or));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,21 +62,21 @@ static int globbed;
|
||||||
static char *entp;
|
static char *entp;
|
||||||
static char **sortbas;
|
static char **sortbas;
|
||||||
|
|
||||||
static int any PROTO2(register int, c, register const char *, s)
|
static int any (register int c, register const char * s)
|
||||||
{
|
{
|
||||||
while (*s)
|
while (*s)
|
||||||
if (*s++ == c) return(1);
|
if (*s++ == c) return(1);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tglob PROTO1(char, c)
|
static int tglob (char c)
|
||||||
{
|
{
|
||||||
if (any(c, globchars))
|
if (any(c, globchars))
|
||||||
gflag |= c == '{' ? 2 : 1;
|
gflag |= c == '{' ? 2 : 1;
|
||||||
return (c);
|
return (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int addpath PROTO1(char, c)
|
static int addpath (char c)
|
||||||
{
|
{
|
||||||
if (gpathp >= lastgpathp) globerr = "Pathname too long";
|
if (gpathp >= lastgpathp) globerr = "Pathname too long";
|
||||||
else {
|
else {
|
||||||
|
|
@ -86,14 +86,14 @@ static int addpath PROTO1(char, c)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ginit PROTO1(char **, agargv)
|
static int ginit (char ** agargv)
|
||||||
{
|
{
|
||||||
agargv[0] = 0; gargv = agargv; sortbas = agargv; gargc = 0;
|
agargv[0] = 0; gargv = agargv; sortbas = agargv; gargc = 0;
|
||||||
gnleft = NCARGS - 4;
|
gnleft = NCARGS - 4;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sort PROTO0((void))
|
static void sort (void)
|
||||||
{
|
{
|
||||||
register char **p1, **p2, *c;
|
register char **p1, **p2, *c;
|
||||||
char **Gvp = &gargv[gargc];
|
char **Gvp = &gargv[gargc];
|
||||||
|
|
@ -112,7 +112,7 @@ static void sort PROTO0((void))
|
||||||
sortbas = Gvp;
|
sortbas = Gvp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *strspl PROTO2(register char *, cp, register const char *, dp)
|
static char *strspl (register char * cp, register const char * dp)
|
||||||
{
|
{
|
||||||
register char *ep = (char *)malloc((unsigned)(strlen(cp) + strlen(dp) + 1));
|
register char *ep = (char *)malloc((unsigned)(strlen(cp) + strlen(dp) + 1));
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ static char *strspl PROTO2(register char *, cp, register const char *, dp)
|
||||||
return (ep);
|
return (ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Gcat PROTO2(char *, s1, const char *, s2)
|
static int Gcat (char * s1, const char * s2)
|
||||||
{
|
{
|
||||||
register int len = strlen(s1) + strlen(s2) + 1;
|
register int len = strlen(s1) + strlen(s2) + 1;
|
||||||
|
|
||||||
|
|
@ -139,10 +139,10 @@ static int Gcat PROTO2(char *, s1, const char *, s2)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int execbrc PROTO0((char *, char *));
|
static int execbrc (char *, char *);
|
||||||
void matchdir PROTO0((char *));
|
void matchdir (char *);
|
||||||
|
|
||||||
static void expand PROTO1(char *, as)
|
static void expand (char * as)
|
||||||
{
|
{
|
||||||
register char *cs;
|
register char *cs;
|
||||||
register char *sgpathp, *oldcs;
|
register char *sgpathp, *oldcs;
|
||||||
|
|
@ -180,7 +180,7 @@ static void expand PROTO1(char *, as)
|
||||||
*gpathp = 0;
|
*gpathp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int amatch PROTO2(char *, s, char *, p)
|
static int amatch (char * s, char * p)
|
||||||
{
|
{
|
||||||
register int scc;
|
register int scc;
|
||||||
int ok, lc;
|
int ok, lc;
|
||||||
|
|
@ -251,7 +251,7 @@ slash:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int match PROTO2(char *, s, char *, p)
|
static int match (char * s, char * p)
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
register char *sentp;
|
register char *sentp;
|
||||||
|
|
@ -266,7 +266,7 @@ static int match PROTO2(char *, s, char *, p)
|
||||||
return (c);
|
return (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void matchdir PROTO1(char *, pattern)
|
void matchdir (char * pattern)
|
||||||
{
|
{
|
||||||
struct stat stb;
|
struct stat stb;
|
||||||
register struct rdirent *dp;
|
register struct rdirent *dp;
|
||||||
|
|
@ -297,7 +297,7 @@ void matchdir PROTO1(char *, pattern)
|
||||||
util_closedir(dirp);
|
util_closedir(dirp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int execbrc PROTO2(char *, p, char *, s)
|
static int execbrc (char * p, char * s)
|
||||||
{
|
{
|
||||||
char restbuf[BUFSIZ + 2];
|
char restbuf[BUFSIZ + 2];
|
||||||
register char *pe, *pm, *pl;
|
register char *pe, *pm, *pl;
|
||||||
|
|
@ -358,7 +358,7 @@ doit:
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void acollect PROTO1(register char *, as)
|
static void acollect (register char * as)
|
||||||
{
|
{
|
||||||
register int ogargc = gargc;
|
register int ogargc = gargc;
|
||||||
|
|
||||||
|
|
@ -367,7 +367,7 @@ static void acollect PROTO1(register char *, as)
|
||||||
if (gargc != ogargc) sort();
|
if (gargc != ogargc) sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void collect PROTO1(register char *, as)
|
static void collect (register char * as)
|
||||||
{
|
{
|
||||||
if (eq(as, "{") || eq(as, "{}")) {
|
if (eq(as, "{") || eq(as, "{}")) {
|
||||||
Gcat(as, "");
|
Gcat(as, "");
|
||||||
|
|
@ -375,14 +375,14 @@ static void collect PROTO1(register char *, as)
|
||||||
} else acollect(as);
|
} else acollect(as);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void blkfree PROTO1(char **, av0)
|
static void blkfree (char ** av0)
|
||||||
{
|
{
|
||||||
register char **av = av0;
|
register char **av = av0;
|
||||||
|
|
||||||
while (*av) free(*av++);
|
while (*av) free(*av++);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int blklen PROTO1(register char **, av)
|
static int blklen (register char ** av)
|
||||||
{
|
{
|
||||||
register int i = 0;
|
register int i = 0;
|
||||||
|
|
||||||
|
|
@ -390,7 +390,7 @@ static int blklen PROTO1(register char **, av)
|
||||||
return (i);
|
return (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char **blkcpy PROTO2(char **, oav, register char **, bv)
|
static char **blkcpy (char ** oav, register char ** bv)
|
||||||
{
|
{
|
||||||
register char **av = oav;
|
register char **av = oav;
|
||||||
|
|
||||||
|
|
@ -398,7 +398,7 @@ static char **blkcpy PROTO2(char **, oav, register char **, bv)
|
||||||
return (oav);
|
return (oav);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char **copyblk PROTO1(register char **, v)
|
static char **copyblk (register char ** v)
|
||||||
{
|
{
|
||||||
register char **nv;
|
register char **nv;
|
||||||
|
|
||||||
|
|
@ -410,23 +410,13 @@ static char **copyblk PROTO1(register char **, v)
|
||||||
return (blkcpy(nv, v));
|
return (blkcpy(nv, v));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PROTOTYPES
|
|
||||||
typedef int (*charfunc) (char) ;
|
typedef int (*charfunc) (char) ;
|
||||||
static void rscan (register char **t, charfunc f)
|
static void rscan (register char **t, charfunc f)
|
||||||
#else
|
|
||||||
static void rscan(t, f)
|
|
||||||
register char **t;
|
|
||||||
int (*f)();
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
register char *p, c;
|
register char *p, c;
|
||||||
|
|
||||||
while ((p = *t++)) {
|
while ((p = *t++)) {
|
||||||
#ifdef PROTOTYPES
|
|
||||||
if (f == (charfunc) tglob)
|
if (f == (charfunc) tglob)
|
||||||
#else
|
|
||||||
if (f == tglob)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (*p == '~') gflag |= 2;
|
if (*p == '~') gflag |= 2;
|
||||||
else if (eq(p, "{") || eq(p, "{}")) continue;
|
else if (eq(p, "{") || eq(p, "{}")) continue;
|
||||||
|
|
@ -435,7 +425,7 @@ static void rscan(t, f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char **glob PROTO1(register char *, v)
|
char **glob (register char * v)
|
||||||
{
|
{
|
||||||
char agpath[BUFSIZ];
|
char agpath[BUFSIZ];
|
||||||
char *agargv[GAVSIZ];
|
char *agargv[GAVSIZ];
|
||||||
|
|
@ -443,11 +433,7 @@ char **glob PROTO1(register char *, v)
|
||||||
vv[0] = v;
|
vv[0] = v;
|
||||||
vv[1] = 0;
|
vv[1] = 0;
|
||||||
gflag = 0;
|
gflag = 0;
|
||||||
#ifdef PROTOTYPES
|
|
||||||
rscan(vv, (charfunc) tglob);
|
rscan(vv, (charfunc) tglob);
|
||||||
#else
|
|
||||||
rscan(vv, tglob);
|
|
||||||
#endif
|
|
||||||
if (gflag == 0) return (copyblk(vv));
|
if (gflag == 0) return (copyblk(vv));
|
||||||
|
|
||||||
globerr = 0;
|
globerr = 0;
|
||||||
|
|
|
||||||
18
bsd_src/ls.c
18
bsd_src/ls.c
|
|
@ -44,8 +44,8 @@ static char path[2*1024 + 1];
|
||||||
static char *endofpath = path;
|
static char *endofpath = path;
|
||||||
|
|
||||||
typedef int (*COMPAR)(const void *, const void *);
|
typedef int (*COMPAR)(const void *, const void *);
|
||||||
int (*sortfcn)PROTO0((LS *, LS *));
|
int (*sortfcn)(LS *, LS *);
|
||||||
void (*printfcn)PROTO0((LS *, int));
|
void (*printfcn)(LS *, int);
|
||||||
|
|
||||||
int termwidth = 80; /* default terminal width */
|
int termwidth = 80; /* default terminal width */
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ int f_timesort; /* sort by time vice name */
|
||||||
int f_total; /* if precede with "total" line */
|
int f_total; /* if precede with "total" line */
|
||||||
int f_type; /* add type character for non-regular files */
|
int f_type; /* add type character for non-regular files */
|
||||||
|
|
||||||
static int tabdir PROTO2(LS *, lp, LS **, s_stats)
|
static int tabdir (LS * lp, LS ** s_stats)
|
||||||
{
|
{
|
||||||
register RDIR *dirp;
|
register RDIR *dirp;
|
||||||
register int cnt, maxentry, maxlen;
|
register int cnt, maxentry, maxlen;
|
||||||
|
|
@ -146,9 +146,9 @@ static int tabdir PROTO2(LS *, lp, LS **, s_stats)
|
||||||
return(cnt);
|
return(cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void displaydir PROTO0((LS *, register int));
|
static void displaydir (LS *, register int);
|
||||||
|
|
||||||
static void subdir PROTO1(LS *, lp)
|
static void subdir (LS * lp)
|
||||||
{
|
{
|
||||||
LS *stats;
|
LS *stats;
|
||||||
int num;
|
int num;
|
||||||
|
|
@ -170,7 +170,7 @@ static void subdir PROTO1(LS *, lp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void displaydir PROTO2(LS *, stats, register int, num)
|
static void displaydir (LS * stats, register int num)
|
||||||
{
|
{
|
||||||
register char *p, *savedpath;
|
register char *p, *savedpath;
|
||||||
LS *lp;
|
LS *lp;
|
||||||
|
|
@ -205,7 +205,7 @@ static void displaydir PROTO2(LS *, stats, register int, num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doargs PROTO2(int, argc, char **, argv)
|
static void doargs (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
register LS *dstatp, *rstatp;
|
register LS *dstatp, *rstatp;
|
||||||
register int cnt, dircnt, dirmax, maxlen, regcnt, regmax;
|
register int cnt, dircnt, dirmax, maxlen, regcnt, regmax;
|
||||||
|
|
@ -229,6 +229,8 @@ static void doargs PROTO2(int, argc, char **, argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ; *av; av++) {
|
for( ; *av; av++) {
|
||||||
|
/* TODO: this stat call should be avoided for performance speedups */
|
||||||
|
/* Better is turn it to get_dirblk or something like this */
|
||||||
if (util_stat(*av, &sb)) {
|
if (util_stat(*av, &sb)) {
|
||||||
perror(*av);
|
perror(*av);
|
||||||
if (errno == ENOENT) continue;
|
if (errno == ENOENT) continue;
|
||||||
|
|
@ -309,7 +311,7 @@ static void doargs PROTO2(int, argc, char **, argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fls_main PROTO2(int, argc, char **, argv)
|
void fls_main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
* yanknode --
|
* yanknode --
|
||||||
* destructively removes the top from the plan
|
* destructively removes the top from the plan
|
||||||
*/
|
*/
|
||||||
static PLAN *yanknode PROTO1(PLAN **, planp)
|
static PLAN *yanknode (PLAN ** planp)
|
||||||
{
|
{
|
||||||
PLAN *node; /* top node removed from the plan */
|
PLAN *node; /* top node removed from the plan */
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ static PLAN *yanknode PROTO1(PLAN **, planp)
|
||||||
* paren_squish. In comments below, an expression is either a
|
* paren_squish. In comments below, an expression is either a
|
||||||
* simple node or a N_EXPR node containing a list of simple nodes.
|
* simple node or a N_EXPR node containing a list of simple nodes.
|
||||||
*/
|
*/
|
||||||
static PLAN *yankexpr PROTO1(PLAN **, planp)
|
static PLAN *yankexpr (PLAN ** planp)
|
||||||
{
|
{
|
||||||
register PLAN *next; /* temp node holding subexpression results */
|
register PLAN *next; /* temp node holding subexpression results */
|
||||||
PLAN *node; /* pointer to returned node or expression */
|
PLAN *node; /* pointer to returned node or expression */
|
||||||
|
|
@ -115,7 +115,7 @@ static PLAN *yankexpr PROTO1(PLAN **, planp)
|
||||||
* paren_squish --
|
* paren_squish --
|
||||||
* replaces "parentheisized" plans in our search plan with "expr" nodes.
|
* replaces "parentheisized" plans in our search plan with "expr" nodes.
|
||||||
*/
|
*/
|
||||||
PLAN *paren_squish PROTO1(PLAN *, plan)
|
PLAN *paren_squish (PLAN * plan)
|
||||||
{
|
{
|
||||||
register PLAN *expr; /* pointer to next expression */
|
register PLAN *expr; /* pointer to next expression */
|
||||||
register PLAN *tail; /* pointer to tail of result plan */
|
register PLAN *tail; /* pointer to tail of result plan */
|
||||||
|
|
@ -152,7 +152,7 @@ PLAN *paren_squish PROTO1(PLAN *, plan)
|
||||||
* not_squish --
|
* not_squish --
|
||||||
* compresses "!" expressions in our search plan.
|
* compresses "!" expressions in our search plan.
|
||||||
*/
|
*/
|
||||||
PLAN *not_squish PROTO1(PLAN *, plan)
|
PLAN *not_squish (PLAN * plan)
|
||||||
{
|
{
|
||||||
register PLAN *next; /* next node being processed */
|
register PLAN *next; /* next node being processed */
|
||||||
register PLAN *node; /* temporary node used in N_NOT processing */
|
register PLAN *node; /* temporary node used in N_NOT processing */
|
||||||
|
|
@ -208,7 +208,7 @@ PLAN *not_squish PROTO1(PLAN *, plan)
|
||||||
* or_squish --
|
* or_squish --
|
||||||
* compresses -o expressions in our search plan.
|
* compresses -o expressions in our search plan.
|
||||||
*/
|
*/
|
||||||
PLAN *or_squish PROTO1(PLAN *, plan)
|
PLAN *or_squish (PLAN * plan)
|
||||||
{
|
{
|
||||||
register PLAN *next; /* next node being processed */
|
register PLAN *next; /* next node being processed */
|
||||||
register PLAN *tail; /* pointer to tail of result plan */
|
register PLAN *tail; /* pointer to tail of result plan */
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ OPTION options[] = {
|
||||||
* add create/process function pointers to node, so we can skip
|
* add create/process function pointers to node, so we can skip
|
||||||
* this switch stuff.
|
* this switch stuff.
|
||||||
*/
|
*/
|
||||||
PLAN *find_create PROTO1(char ***, argvp)
|
PLAN *find_create (char *** argvp)
|
||||||
{
|
{
|
||||||
register OPTION *p;
|
register OPTION *p;
|
||||||
PLAN *new;
|
PLAN *new;
|
||||||
|
|
@ -112,12 +112,12 @@ PLAN *find_create PROTO1(char ***, argvp)
|
||||||
return(new);
|
return(new);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int typecompare PROTO2(const void *, a, const void *, b)
|
static int typecompare (const void * a, const void * b)
|
||||||
{
|
{
|
||||||
return(strcmp(((const OPTION *)a)->name, ((const OPTION *)b)->name));
|
return(strcmp(((const OPTION *)a)->name, ((const OPTION *)b)->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
OPTION *option PROTO1(char *, name)
|
OPTION *option (char * name)
|
||||||
{
|
{
|
||||||
OPTION tmp;
|
OPTION tmp;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
#define BLK(A) (((A)+1023)/1024)
|
#define BLK(A) (((A)+1023)/1024)
|
||||||
|
|
||||||
static int printtype PROTO1(mode_t, mode)
|
static int printtype (mode_t mode)
|
||||||
{
|
{
|
||||||
switch(mode & S_IFMT) {
|
switch(mode & S_IFMT) {
|
||||||
case S_IFDIR:
|
case S_IFDIR:
|
||||||
|
|
@ -62,7 +62,7 @@ static int printtype PROTO1(mode_t, mode)
|
||||||
* print [inode] [size] name
|
* print [inode] [size] name
|
||||||
* return # of characters printed, no trailing characters
|
* return # of characters printed, no trailing characters
|
||||||
*/
|
*/
|
||||||
static int printaname PROTO1(LS *, lp)
|
static int printaname (LS * lp)
|
||||||
{
|
{
|
||||||
int chcnt;
|
int chcnt;
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ static int printaname PROTO1(LS *, lp)
|
||||||
return(chcnt);
|
return(chcnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printscol PROTO2(LS *, stats, int, num)
|
void printscol (LS * stats, int num)
|
||||||
{
|
{
|
||||||
for (; num--; ++stats) {
|
for (; num--; ++stats) {
|
||||||
printaname(stats);
|
printaname(stats);
|
||||||
|
|
@ -93,12 +93,12 @@ void printscol PROTO2(LS *, stats, int, num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printtime PROTO1(time_t, ftime)
|
static void printtime (time_t ftime)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *longstring;
|
char *longstring;
|
||||||
|
|
||||||
longstring = (char *)ctime((long *)&ftime);
|
longstring = (char *)ctime(&ftime);
|
||||||
for (i = 4; i < 11; ++i) (void)putchar(longstring[i]);
|
for (i = 4; i < 11; ++i) (void)putchar(longstring[i]);
|
||||||
|
|
||||||
#define SIXMONTHS ((365 / 2) * 24 * 60 * 60)
|
#define SIXMONTHS ((365 / 2) * 24 * 60 * 60)
|
||||||
|
|
@ -112,7 +112,7 @@ static void printtime PROTO1(time_t, ftime)
|
||||||
(void)putchar(' ');
|
(void)putchar(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
void printlong PROTO2(LS *, stats, int, num)
|
void printlong (LS * stats, int num)
|
||||||
{
|
{
|
||||||
const char *modep;
|
const char *modep;
|
||||||
|
|
||||||
|
|
@ -138,7 +138,7 @@ void printlong PROTO2(LS *, stats, int, num)
|
||||||
|
|
||||||
extern int termwidth;
|
extern int termwidth;
|
||||||
|
|
||||||
void printcol PROTO2(LS *, stats, int, num)
|
void printcol (LS * stats, int num)
|
||||||
{
|
{
|
||||||
register int base, chcnt, cnt, col, colwidth;
|
register int base, chcnt, cnt, col, colwidth;
|
||||||
int endcol, numcols, numrows, row;
|
int endcol, numcols, numrows, row;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "ls.h"
|
#include "ls.h"
|
||||||
|
|
||||||
void prcopy PROTO3(char *, src, char *, dest, int, len)
|
void prcopy (char * src, char * dest, int len)
|
||||||
{
|
{
|
||||||
register int ch;
|
register int ch;
|
||||||
|
|
||||||
|
|
@ -41,13 +41,13 @@ void prcopy PROTO3(char *, src, char *, dest, int, len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nomem PROTO0((void))
|
void nomem (void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "ls: out of memory.\n");
|
(void)fprintf(stderr, "ls: out of memory.\n");
|
||||||
ls_bad(1);
|
ls_bad(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *emalloc PROTO1(int, size)
|
char *emalloc (int size)
|
||||||
{
|
{
|
||||||
char *retval;
|
char *retval;
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ char *emalloc PROTO1(int, size)
|
||||||
return(retval);
|
return(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void usage PROTO0((void))
|
void usage (void)
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: ls [-1ACFLRacdfgiklqrstu] [file ...]\n");
|
(void)fprintf(stderr, "usage: ls [-1ACFLRacdfgiklqrstu] [file ...]\n");
|
||||||
ls_bad(1);
|
ls_bad(1);
|
||||||
|
|
|
||||||
12
client/lib.c
12
client/lib.c
|
|
@ -34,9 +34,9 @@ unsigned long busy_delay = DEFAULT_DELAY; /* busy retransmit timer */
|
||||||
unsigned long idle_delay = DEFAULT_DELAY; /* idle retransmit timer */
|
unsigned long idle_delay = DEFAULT_DELAY; /* idle retransmit timer */
|
||||||
unsigned long udp_sent_time;
|
unsigned long udp_sent_time;
|
||||||
|
|
||||||
UBUF *client_interact PROTO6(unsigned char, cmd, unsigned long, pos,
|
UBUF *client_interact (unsigned char cmd, unsigned long pos,
|
||||||
unsigned int, l1, unsigned const char *, p1,
|
unsigned int l1, unsigned const char * p1,
|
||||||
unsigned int, l2, unsigned const char *, p2)
|
unsigned int l2, unsigned const char * p2)
|
||||||
{
|
{
|
||||||
struct sockaddr_in from;
|
struct sockaddr_in from;
|
||||||
UBUF sbuf;
|
UBUF sbuf;
|
||||||
|
|
@ -186,7 +186,7 @@ UBUF *client_interact PROTO6(unsigned char, cmd, unsigned long, pos,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static RETSIGTYPE client_intr PROTO1(int, signum)
|
static RETSIGTYPE client_intr (int signum)
|
||||||
{
|
{
|
||||||
switch(client_intr_state) {
|
switch(client_intr_state) {
|
||||||
case 0: exit(2);
|
case 0: exit(2);
|
||||||
|
|
@ -198,7 +198,7 @@ static RETSIGTYPE client_intr PROTO1(int, signum)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_client PROTO3(const char *, host, unsigned short, port, unsigned short, myport)
|
void init_client (const char * host, unsigned short port, unsigned short myport)
|
||||||
{
|
{
|
||||||
busy_delay = idle_delay = target_delay;
|
busy_delay = idle_delay = target_delay;
|
||||||
myseq = random();
|
myseq = random();
|
||||||
|
|
@ -217,7 +217,7 @@ void init_client PROTO3(const char *, host, unsigned short, port, unsigned short
|
||||||
signal(SIGINT,client_intr);
|
signal(SIGINT,client_intr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int client_done PROTO0((void))
|
int client_done (void)
|
||||||
{
|
{
|
||||||
(void) client_interact(CC_BYE, 0L, 0, (unsigned char *)NULLP, 0,
|
(void) client_interact(CC_BYE, 0L, 0, (unsigned char *)NULLP, 0,
|
||||||
(unsigned char *)NULLP);
|
(unsigned char *)NULLP);
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ static char key_string[sizeof(KEY_PREFIX)+32];
|
||||||
static char code_str[] =
|
static char code_str[] =
|
||||||
"0123456789:_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
"0123456789:_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
|
|
||||||
static void make_key_string PROTO2(unsigned long, server_addr,
|
static void make_key_string( unsigned long server_addr,
|
||||||
unsigned long, server_port)
|
unsigned long server_port)
|
||||||
{
|
{
|
||||||
unsigned long v1, v2;
|
unsigned long v1, v2;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
@ -190,7 +190,7 @@ static unsigned short *share_key;
|
||||||
static unsigned int lock_fd;
|
static unsigned int lock_fd;
|
||||||
static int lock_shm;
|
static int lock_shm;
|
||||||
|
|
||||||
unsigned short client_get_key PROTO0((void))
|
unsigned short client_get_key (void)
|
||||||
{
|
{
|
||||||
if(lockf(lock_fd,F_LOCK,2) == -1) {
|
if(lockf(lock_fd,F_LOCK,2) == -1) {
|
||||||
perror("lockf");
|
perror("lockf");
|
||||||
|
|
@ -199,7 +199,7 @@ unsigned short client_get_key PROTO0((void))
|
||||||
return(*share_key);
|
return(*share_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_set_key PROTO1(unsigned short, key)
|
void client_set_key (unsigned short key)
|
||||||
{
|
{
|
||||||
*share_key = key;
|
*share_key = key;
|
||||||
if(lockf(lock_fd,F_ULOCK,2) == -1) {
|
if(lockf(lock_fd,F_ULOCK,2) == -1) {
|
||||||
|
|
@ -208,9 +208,9 @@ void client_set_key PROTO1(unsigned short, key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_init_key PROTO3(unsigned long, server_addr,
|
void client_init_key (unsigned long server_addr,
|
||||||
unsigned long, server_port,
|
unsigned long server_port,
|
||||||
unsigned short, key)
|
unsigned short key)
|
||||||
{
|
{
|
||||||
unsigned long omask;
|
unsigned long omask;
|
||||||
key_t lock_key;
|
key_t lock_key;
|
||||||
|
|
@ -260,19 +260,19 @@ void client_destroy_key(void)
|
||||||
int key_persists = 0;
|
int key_persists = 0;
|
||||||
static unsigned short okey;
|
static unsigned short okey;
|
||||||
|
|
||||||
unsigned short client_get_key PROTO0((void))
|
unsigned short client_get_key (void)
|
||||||
{
|
{
|
||||||
return(okey);
|
return(okey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_set_key PROTO1(unsigned short, key)
|
void client_set_key (unsigned short key)
|
||||||
{
|
{
|
||||||
okey = key;
|
okey = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_init_key PROTO3(unsigned long, server_addr,
|
void client_init_key (unsigned long server_addr,
|
||||||
unsigned long, server_port,
|
unsigned long server_port,
|
||||||
unsigned short, key)
|
unsigned short key)
|
||||||
{
|
{
|
||||||
okey = key;
|
okey = key;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,19 +31,30 @@ unsigned short client_net_len;
|
||||||
#define FOURGIGS 0xffffffffUL
|
#define FOURGIGS 0xffffffffUL
|
||||||
|
|
||||||
/* returns mallocated abs. path merged from s2 and env.dir */
|
/* returns mallocated abs. path merged from s2 and env.dir */
|
||||||
char *util_abs_path PROTO1(const char *, s2)
|
#define APPEND_PASSWORD if(have_password) \
|
||||||
|
{ \
|
||||||
|
strcat(path,"\n"); \
|
||||||
|
strcat(path,env_passwd); \
|
||||||
|
}
|
||||||
|
char *util_abs_path (const char * s2)
|
||||||
{
|
{
|
||||||
char *path, *s, *d, *t;
|
char *path, *s, *d, *t;
|
||||||
|
int have_password = 0;
|
||||||
|
|
||||||
if(!env_dir) env_dir = "";
|
if(!env_dir) env_dir = "";
|
||||||
if(!s2) s2 = "";
|
if(!s2) s2 = "";
|
||||||
|
if(strlen(env_passwd)>0)
|
||||||
|
have_password=1;
|
||||||
if(*s2 == '/') {
|
if(*s2 == '/') {
|
||||||
path = malloc(strlen(s2)+2+strlen(env_passwd)+1);
|
path = malloc(strlen(s2)+2+strlen(env_passwd)+1);
|
||||||
sprintf(path,"/%s",s2);
|
sprintf(path,"/%s",s2);
|
||||||
|
if(have_password)
|
||||||
|
util_junk_password(path);
|
||||||
} else {
|
} else {
|
||||||
path = malloc(strlen(env_dir)+strlen(s2)+3+strlen(env_passwd)+1);
|
path = malloc(strlen(env_dir)+strlen(s2)+3+strlen(env_passwd)+1);
|
||||||
sprintf(path,"/%s/%s",env_dir,s2);
|
sprintf(path,"/%s/%s",env_dir,s2);
|
||||||
|
if(have_password)
|
||||||
|
util_junk_password(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(t = path; *t; ) {
|
for(t = path; *t; ) {
|
||||||
|
|
@ -54,6 +65,7 @@ char *util_abs_path PROTO1(const char *, s2)
|
||||||
if(t[0] == '.' && t[1] == '.') {
|
if(t[0] == '.' && t[1] == '.') {
|
||||||
if(t-1 == path && t[2] == 0 ) {
|
if(t-1 == path && t[2] == 0 ) {
|
||||||
*t = 0;
|
*t = 0;
|
||||||
|
APPEND_PASSWORD;
|
||||||
return(path);
|
return(path);
|
||||||
}
|
}
|
||||||
if(t-1 == path && t[2] == '/') {
|
if(t-1 == path && t[2] == '/') {
|
||||||
|
|
@ -67,6 +79,7 @@ char *util_abs_path PROTO1(const char *, s2)
|
||||||
if(t != path || *s == '/') for(d = t; (*d++ = *s++); );
|
if(t != path || *s == '/') for(d = t; (*d++ = *s++); );
|
||||||
else {
|
else {
|
||||||
t[1] = 0;
|
t[1] = 0;
|
||||||
|
APPEND_PASSWORD;
|
||||||
return(path);
|
return(path);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -75,6 +88,7 @@ char *util_abs_path PROTO1(const char *, s2)
|
||||||
if(t[0] == '.') {
|
if(t[0] == '.') {
|
||||||
if(t-1 == path && t[1] == 0 ) {
|
if(t-1 == path && t[1] == 0 ) {
|
||||||
*t = 0;
|
*t = 0;
|
||||||
|
APPEND_PASSWORD;
|
||||||
return(path);
|
return(path);
|
||||||
}
|
}
|
||||||
if(t-1 == path && t[1] == '/') {
|
if(t-1 == path && t[1] == '/') {
|
||||||
|
|
@ -90,11 +104,12 @@ char *util_abs_path PROTO1(const char *, s2)
|
||||||
}
|
}
|
||||||
t++;
|
t++;
|
||||||
}
|
}
|
||||||
|
APPEND_PASSWORD;
|
||||||
return(path);
|
return(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int util_split_path PROTO4(char *, path, char **, p1, char **, p2,
|
static int util_split_path (char * path, char ** p1, char ** p2,
|
||||||
char **, p3)
|
char ** p3)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
static char junk;
|
static char junk;
|
||||||
|
|
@ -121,13 +136,13 @@ static int util_split_path PROTO4(char *, path, char **, p1, char **, p2,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return current working directory (from environment) */
|
/* return current working directory (from environment) */
|
||||||
char *util_getwd PROTO1(char *, p)
|
char *util_getwd (char * p)
|
||||||
{
|
{
|
||||||
if(p) strcpy(p,env_dir);
|
if(p) strcpy(p,env_dir);
|
||||||
return(p);
|
return(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RDIRENT **get_dir_blk PROTO1(char *, path)
|
static RDIRENT **get_dir_blk (char * path)
|
||||||
{
|
{
|
||||||
RDIRENT **dp;
|
RDIRENT **dp;
|
||||||
char *p1, *p2, *fpath, buf[2*UBUF_SPACE];
|
char *p1, *p2, *fpath, buf[2*UBUF_SPACE];
|
||||||
|
|
@ -214,8 +229,8 @@ static RDIRENT **get_dir_blk PROTO1(char *, path)
|
||||||
free(fpath);
|
free(fpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int util_download_main PROTO5(char *, path, char *, fpath, FILE *, fp,
|
static int util_download_main (char * path, char * fpath, FILE * fp,
|
||||||
unsigned long, start_from, int, cmd)
|
unsigned long start_from, int cmd)
|
||||||
{
|
{
|
||||||
unsigned long pos, started_from = start_from, downloaded;
|
unsigned long pos, started_from = start_from, downloaded;
|
||||||
unsigned tmax, wrote, sent_time, rlen;
|
unsigned tmax, wrote, sent_time, rlen;
|
||||||
|
|
@ -268,7 +283,7 @@ static int util_download_main PROTO5(char *, path, char *, fpath, FILE *, fp,
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int util_download PROTO3(char *, path, FILE *, fp, unsigned long, start_from)
|
int util_download (char * path, FILE * fp, unsigned long start_from)
|
||||||
{
|
{
|
||||||
int code, len;
|
int code, len;
|
||||||
char *fpath;
|
char *fpath;
|
||||||
|
|
@ -284,7 +299,7 @@ int util_download PROTO3(char *, path, FILE *, fp, unsigned long, start_from)
|
||||||
return(code);
|
return(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
int util_grab_file PROTO3(char *, path, FILE *, fp, unsigned long, start_from)
|
int util_grab_file (char * path, FILE * fp, unsigned long start_from)
|
||||||
{
|
{
|
||||||
int code, len;
|
int code, len;
|
||||||
char *fpath;
|
char *fpath;
|
||||||
|
|
@ -313,7 +328,7 @@ int util_grab_file PROTO3(char *, path, FILE *, fp, unsigned long, start_from)
|
||||||
return(code);
|
return(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
int util_upload PROTO3(char *, path, FILE *, fp, time_t , stamp)
|
int util_upload (char * path, FILE * fp, time_t stamp)
|
||||||
{
|
{
|
||||||
unsigned long pos;
|
unsigned long pos;
|
||||||
unsigned bytes, first, tmax, sent_time;
|
unsigned bytes, first, tmax, sent_time;
|
||||||
|
|
@ -422,7 +437,7 @@ int util_upload PROTO3(char *, path, FILE *, fp, time_t , stamp)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void util_get_env PROTO0((void))
|
static void util_get_env (void)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
|
@ -463,7 +478,7 @@ static void util_get_env PROTO0((void))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void env_client PROTO0((void))
|
void env_client (void)
|
||||||
{
|
{
|
||||||
util_get_env();
|
util_get_env();
|
||||||
init_client(env_host,atoi(env_port),atoi(env_myport));
|
init_client(env_host,atoi(env_port),atoi(env_myport));
|
||||||
|
|
@ -471,7 +486,7 @@ void env_client PROTO0((void))
|
||||||
|
|
||||||
static DDLIST *ddroot = 0;
|
static DDLIST *ddroot = 0;
|
||||||
|
|
||||||
RDIR *util_opendir PROTO1(char *, path)
|
RDIR *util_opendir (char * path)
|
||||||
{
|
{
|
||||||
char *fpath;
|
char *fpath;
|
||||||
RDIRENT **dep;
|
RDIRENT **dep;
|
||||||
|
|
@ -505,13 +520,13 @@ RDIR *util_opendir PROTO1(char *, path)
|
||||||
return(rdirp);
|
return(rdirp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void util_closedir PROTO1(RDIR *, rdirp)
|
void util_closedir (RDIR * rdirp)
|
||||||
{
|
{
|
||||||
rdirp->ddp->ref_cnt--;
|
rdirp->ddp->ref_cnt--;
|
||||||
free(rdirp);
|
free(rdirp);
|
||||||
}
|
}
|
||||||
|
|
||||||
rdirent *util_readdir PROTO1(RDIR *, rdirp)
|
rdirent *util_readdir (RDIR * rdirp)
|
||||||
{
|
{
|
||||||
static rdirent rde;
|
static rdirent rde;
|
||||||
RDIRENT **dep;
|
RDIRENT **dep;
|
||||||
|
|
@ -529,8 +544,18 @@ rdirent *util_readdir PROTO1(RDIR *, rdirp)
|
||||||
return(&rde);
|
return(&rde);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Removes \npassword from input */
|
||||||
|
void util_junk_password(char *path)
|
||||||
|
{
|
||||||
|
char *pos;
|
||||||
|
|
||||||
int util_stat PROTO2(char *, path, struct stat *, sbuf)
|
pos=strchr(path,'\n');
|
||||||
|
if(pos != NULL)
|
||||||
|
/* terminate them! */
|
||||||
|
*pos='\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
int util_stat (char * path, struct stat * sbuf)
|
||||||
{
|
{
|
||||||
static int statworks=1;
|
static int statworks=1;
|
||||||
RDIR *drp;
|
RDIR *drp;
|
||||||
|
|
@ -640,7 +665,7 @@ int util_stat PROTO2(char *, path, struct stat *, sbuf)
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int util_cd PROTO1(char *, p)
|
int util_cd (char * p)
|
||||||
{
|
{
|
||||||
char *fpath;
|
char *fpath;
|
||||||
UBUF *ub;
|
UBUF *ub;
|
||||||
|
|
@ -671,7 +696,7 @@ int util_cd PROTO1(char *, p)
|
||||||
/* Perform a cd, but don't verify path. Assume the path has been
|
/* Perform a cd, but don't verify path. Assume the path has been
|
||||||
* pre-verified
|
* pre-verified
|
||||||
*/
|
*/
|
||||||
int util_cd2 PROTO1(char *, p)
|
int util_cd2 (char * p)
|
||||||
{
|
{
|
||||||
char *fpath;
|
char *fpath;
|
||||||
|
|
||||||
|
|
@ -683,20 +708,11 @@ int util_cd2 PROTO1(char *, p)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PROTOTYPES
|
|
||||||
void util_process_file(char *path, int mode,
|
void util_process_file(char *path, int mode,
|
||||||
void (*process_file)(char *,struct stat *, int, int),
|
void (*process_file)(char *,struct stat *, int, int),
|
||||||
int (*process_start_dir)(char *,struct stat *,u_long *),
|
int (*process_start_dir)(char *,struct stat *,u_long *),
|
||||||
void (*process_end_dir)(char *,int,u_long,int),
|
void (*process_end_dir)(char *,int,u_long,int),
|
||||||
int level)
|
int level)
|
||||||
#else
|
|
||||||
void util_process_file(path, mode, process_file, process_start_dir,
|
|
||||||
process_end_dir, level)
|
|
||||||
char *path;
|
|
||||||
int mode, level;
|
|
||||||
void (*process_file)(), (*process_end_dir)();
|
|
||||||
int (*process_start_dir)();
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
struct stat sbuf;
|
struct stat sbuf;
|
||||||
RDIR *rdir;
|
RDIR *rdir;
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,22 @@
|
||||||
|
|
||||||
bin_PROGRAMS=fcatcmd fcdcmd fducmd ffindcmd fgetcmd fgrabcmd fhostcmd \
|
bin_PROGRAMS=fcatcmd fcdcmd fducmd ffindcmd fgetcmd fgrabcmd fhostcmd \
|
||||||
flscmd fmkdir fprocmd fput frmcmd frmdircmd fver fspmerge \
|
flscmd fmkdir fprocmd fput frmcmd frmdircmd fver fspmerge \
|
||||||
fstatcmd
|
fstatcmd fmvcmd
|
||||||
|
|
||||||
LDADD=-L../common -L../bsd_src -L../client -lclient -lcommon -lbsdfsp $(EX_LIBS)
|
LDADD=-L../common -L../bsd_src -L../client -lclient -lcommon -lbsdfsp $(EX_LIBS)
|
||||||
|
|
||||||
fspmerge_SOURCES=merge.c printpro.c fspprof.l
|
fspmerge_SOURCES=merge.c printpro.c fspprof.l
|
||||||
fcdcmd_SOURCES=fcdcmd.c printpro.c
|
fcdcmd_SOURCES=fcdcmd.c printpro.c
|
||||||
fprocmd_SOURCES=printpro.c fprocmd.c
|
fprocmd_SOURCES=printpro.c fprocmd.c
|
||||||
noinst_HEADERS=printpro.h fhost.h
|
noinst_HEADERS=printpro.h fhost.h merge.h
|
||||||
fhostcmd_SOURCES=fhostcmd.c fspprof.l
|
fhostcmd_SOURCES=fhostcmd.c fspprof.l
|
||||||
fhostcmd_LDADD=$(LDADD)
|
fhostcmd_LDADD=$(LDADD)
|
||||||
|
|
||||||
fspmerge_LDADD=fcatcmd_m.o fcdcmd_m.o fducmd_m.o ffindcmd_m.o fgetcmd_m.o \
|
fspmerge_LDADD=fcatcmd_m.o fcdcmd_m.o fducmd_m.o ffindcmd_m.o fgetcmd_m.o \
|
||||||
fgrabcmd_m.o fhostcmd_m.o flscmd_m.o fmkdir_m.o fprocmd_m.o \
|
fgrabcmd_m.o fhostcmd_m.o flscmd_m.o fmkdir_m.o fprocmd_m.o \
|
||||||
fput_m.o frmcmd_m.o frmdircmd_m.o fver_m.o \
|
fput_m.o frmcmd_m.o frmdircmd_m.o fver_m.o fmvcmd_m.o \
|
||||||
fstatcmd_m.o $(LDADD)
|
fstatcmd_m.o $(LDADD)
|
||||||
|
|
||||||
|
|
||||||
fgetcmd_CFLAGS:=-DCOMMAND_GET
|
fgetcmd_CFLAGS:=-DCOMMAND_GET
|
||||||
|
|
||||||
AM_CFLAGS:=-DSYSCONFDIR="\"@sysconfdir@\"" $(AM_CFLAGS)
|
AM_CFLAGS:=-DSYSCONFDIR="\"@sysconfdir@\"" $(AM_CFLAGS)
|
||||||
|
|
@ -84,4 +83,8 @@ fstatcmd_m.o:
|
||||||
@echo '#include "fstatcmd.c"' > fstatcmd_m.c
|
@echo '#include "fstatcmd.c"' > fstatcmd_m.c
|
||||||
${COMPILE} -Dmain=fstatcmd_main -c fstatcmd_m.c
|
${COMPILE} -Dmain=fstatcmd_main -c fstatcmd_m.c
|
||||||
@rm -f fstatcmd_m.c
|
@rm -f fstatcmd_m.c
|
||||||
|
fmvcmd_m.o:
|
||||||
|
@echo '#include "fmvcmd.c"' > fmvcmd_m.c
|
||||||
|
${COMPILE} -Dmain=fmvcmd_main -c fmvcmd_m.c
|
||||||
|
@rm -f fmvcmd_m.c
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,14 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static RETSIGTYPE dont_die PROTO1(int, signum)
|
static RETSIGTYPE dont_die (int signum)
|
||||||
{
|
{
|
||||||
#ifndef RELIABLE_SIGNALS
|
#ifndef RELIABLE_SIGNALS
|
||||||
signal(SIGPIPE,dont_die);
|
signal(SIGPIPE,dont_die);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
char **av;
|
char **av;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "merge.h"
|
#include "merge.h"
|
||||||
#include "printpro.h"
|
#include "printpro.h"
|
||||||
|
|
||||||
static int f_cd PROTO1(const char *, p)
|
static int f_cd (const char * p)
|
||||||
{
|
{
|
||||||
UBUF *ub;
|
UBUF *ub;
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ static int f_cd PROTO1(const char *, p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
char *np;
|
char *np;
|
||||||
char **av, *av2[2];
|
char **av, *av2[2];
|
||||||
|
|
@ -54,7 +54,11 @@ int main PROTO2(int, argc, char **, argv)
|
||||||
av2[1] = 0;
|
av2[1] = 0;
|
||||||
}
|
}
|
||||||
np = util_abs_path(*av);
|
np = util_abs_path(*av);
|
||||||
if(f_cd(np))puts(np);
|
if(f_cd(np))
|
||||||
|
{
|
||||||
|
util_junk_password(np);
|
||||||
|
puts(np);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
puts(env_dir);
|
puts(env_dir);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@
|
||||||
|
|
||||||
static u_long total_file_size;
|
static u_long total_file_size;
|
||||||
|
|
||||||
static void add_file_size PROTO4(char *, name, struct stat *, sbufp,
|
static void add_file_size (char * name, struct stat * sbufp,
|
||||||
int, mode, int, level)
|
int mode, int level)
|
||||||
{
|
{
|
||||||
register u_long file_size;
|
register u_long file_size;
|
||||||
|
|
||||||
|
|
@ -45,13 +45,13 @@ static void add_file_size PROTO4(char *, name, struct stat *, sbufp,
|
||||||
((mode & EACH) && level < 2)) printf("%-7ld %s\n", file_size, name);
|
((mode & EACH) && level < 2)) printf("%-7ld %s\n", file_size, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int start_dir PROTO3(char *, name, struct stat *, sbufp, u_long *, sum)
|
static int start_dir (char * name, struct stat * sbufp, u_long * sum)
|
||||||
{
|
{
|
||||||
*sum = total_file_size;
|
*sum = total_file_size;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void end_dir PROTO4(char *, path, int, mode, u_long, sum, int, level)
|
static void end_dir (char * path, int mode, u_long sum, int level)
|
||||||
{
|
{
|
||||||
/* directories are printed as default */
|
/* directories are printed as default */
|
||||||
/* but, check recursion level */
|
/* but, check recursion level */
|
||||||
|
|
@ -64,7 +64,7 @@ static void end_dir PROTO4(char *, path, int, mode, u_long, sum, int, level)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int mode=0;
|
int mode=0;
|
||||||
int filcnt = 0;
|
int filcnt = 0;
|
||||||
|
|
|
||||||
|
|
@ -64,17 +64,17 @@ time_t now; /* time find was run */
|
||||||
int isoutput; /* user specified output operator */
|
int isoutput; /* user specified output operator */
|
||||||
int process; /* process current directory */
|
int process; /* process current directory */
|
||||||
|
|
||||||
static void usage_ffind PROTO0((void));
|
static void usage_ffind (void);
|
||||||
|
|
||||||
static void eval_file PROTO4(char *, name, struct stat *, sbufp,
|
static void eval_file (char * name, struct stat * sbufp,
|
||||||
int, mode, int, level)
|
int mode, int level)
|
||||||
{
|
{
|
||||||
register PLAN *p;
|
register PLAN *p;
|
||||||
|
|
||||||
for (p = plan; p && (p->eval)(p, sbufp, name); p = p->next);
|
for (p = plan; p && (p->eval)(p, sbufp, name); p = p->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int eval_dir PROTO3(char *, name, struct stat *, sbufp, u_long *, sum)
|
static int eval_dir (char * name, struct stat * sbufp, u_long * sum)
|
||||||
{
|
{
|
||||||
register PLAN *p;
|
register PLAN *p;
|
||||||
|
|
||||||
|
|
@ -83,7 +83,7 @@ static int eval_dir PROTO3(char *, name, struct stat *, sbufp, u_long *, sum)
|
||||||
return (process);
|
return (process);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
register char **p;
|
register char **p;
|
||||||
char *singlefile[2], **files;
|
char *singlefile[2], **files;
|
||||||
|
|
@ -117,7 +117,7 @@ int main PROTO2(int, argc, char **, argv)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage_ffind PROTO0((void))
|
static void usage_ffind (void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"usage: ffind file [file ...] expression\n");
|
fprintf(stderr,"usage: ffind file [file ...] expression\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ static unsigned long start_from;
|
||||||
|
|
||||||
static int len;
|
static int len;
|
||||||
|
|
||||||
static RETSIGTYPE fsp_cleanup PROTO1(int, signum)
|
static RETSIGTYPE fsp_cleanup (int signum)
|
||||||
{
|
{
|
||||||
char filename[20];
|
char filename[20];
|
||||||
sprintf(filename,".fsp.%d",getpid());
|
sprintf(filename,".fsp.%d",getpid());
|
||||||
|
|
@ -57,7 +57,7 @@ get_file
|
||||||
#else
|
#else
|
||||||
grab_file
|
grab_file
|
||||||
#endif
|
#endif
|
||||||
PROTO4(char *, path, struct stat *, sbufp, int, mode, int, level)
|
(char * path, struct stat * sbufp, int mode, int level)
|
||||||
{
|
{
|
||||||
char *name = path + len;
|
char *name = path + len;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
@ -150,7 +150,7 @@ PROTO4(char *, path, struct stat *, sbufp, int, mode, int, level)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int make_dir PROTO3(char *, name, struct stat *, sbufp, u_long *, mode)
|
static int make_dir (char * name, struct stat * sbufp, u_long * mode)
|
||||||
{
|
{
|
||||||
struct stat sbuf;
|
struct stat sbuf;
|
||||||
|
|
||||||
|
|
@ -178,7 +178,7 @@ static int make_dir PROTO3(char *, name, struct stat *, sbufp, u_long *, mode)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage PROTO0((void))
|
static void usage (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef COMMAND_GET
|
#ifdef COMMAND_GET
|
||||||
|
|
@ -200,7 +200,7 @@ static void usage PROTO0((void))
|
||||||
* -r recursively get directories
|
* -r recursively get directories
|
||||||
* -p preserve date/times of original file on downloaded copy
|
* -p preserve date/times of original file on downloaded copy
|
||||||
*/
|
*/
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
char **av, *av2[2], n[1024];
|
char **av, *av2[2], n[1024];
|
||||||
int prompt, mode = 0;
|
int prompt, mode = 0;
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ static struct fsp_host *find_host(const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void host_usage PROTO0((void)) /* print usage message */
|
static void host_usage (void) /* print usage message */
|
||||||
{
|
{
|
||||||
fprintf(stderr,"Usage: fhost [-d delay] [-p local port] [-l local dir]\n");
|
fprintf(stderr,"Usage: fhost [-d delay] [-p local port] [-l local dir]\n");
|
||||||
fprintf(stderr," [-o timeout] [-t trace] [-w password]\n");
|
fprintf(stderr," [-o timeout] [-t trace] [-w password]\n");
|
||||||
|
|
@ -125,7 +125,7 @@ static void host_usage PROTO0((void)) /* print usage message */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get data out of resource file */
|
/* get data out of resource file */
|
||||||
static void parse_prof_file_new PROTO1(const char *, filename)
|
static void parse_prof_file_new (const char * filename)
|
||||||
{
|
{
|
||||||
|
|
||||||
FILE *input=NULL;
|
FILE *input=NULL;
|
||||||
|
|
@ -150,7 +150,7 @@ static void parse_prof_file_new PROTO1(const char *, filename)
|
||||||
fclose(input);
|
fclose(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void list_prof_file PROTO0((void)) /* list resource file */
|
static void list_prof_file (void) /* list resource file */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<hostsize;i++)
|
for(i=0;i<hostsize;i++)
|
||||||
|
|
@ -161,7 +161,7 @@ static void list_prof_file PROTO0((void)) /* list resource file */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int optletter,csh,lhost=0;
|
int optletter,csh,lhost=0;
|
||||||
register char *p;
|
register char *p;
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,13 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ls_bad PROTO1(int, n)
|
int ls_bad (int n)
|
||||||
{
|
{
|
||||||
client_done();
|
client_done();
|
||||||
exit(n);
|
exit(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
env_client();
|
env_client();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#include "my-string.h"
|
#include "my-string.h"
|
||||||
#include "merge.h"
|
#include "merge.h"
|
||||||
|
|
||||||
static int make_dir PROTO1(char *, p)
|
static int make_dir (char * p)
|
||||||
{
|
{
|
||||||
char *op;
|
char *op;
|
||||||
UBUF *ub;
|
UBUF *ub;
|
||||||
|
|
@ -41,7 +41,7 @@ static int make_dir PROTO1(char *, p)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
env_client();
|
env_client();
|
||||||
while(*++argv) make_dir(*argv);
|
while(*++argv) make_dir(*argv);
|
||||||
|
|
|
||||||
101
clients/fmvcmd.c
Normal file
101
clients/fmvcmd.c
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*********************************************************************\
|
||||||
|
* Copyright (c) 2004 by Radim Kolar (hsn@netmag.cz) *
|
||||||
|
* Copyright (c) 1991 by Wen-King Su (wen-king@vlsi.cs.caltech.edu) *
|
||||||
|
* *
|
||||||
|
* You may copy or modify this file in any manner you wish, provided *
|
||||||
|
* that this notice is always included, and that you hold the author *
|
||||||
|
* harmless for any loss or damage resulting from the installation or *
|
||||||
|
* use of this software. *
|
||||||
|
\*********************************************************************/
|
||||||
|
|
||||||
|
#include "tweak.h"
|
||||||
|
#include "client_def.h"
|
||||||
|
#include "c_extern.h"
|
||||||
|
#include "bsd_extern.h"
|
||||||
|
#include "co_extern.h"
|
||||||
|
#ifdef STDC_HEADERS
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#include "my-string.h"
|
||||||
|
#include "merge.h"
|
||||||
|
|
||||||
|
static unsigned int n;
|
||||||
|
static unsigned char buf[UBUF_SPACE];
|
||||||
|
|
||||||
|
static int append_to_buf(const char *what,size_t len)
|
||||||
|
{
|
||||||
|
if(n+len > UBUF_SPACE )
|
||||||
|
return -1;
|
||||||
|
memcpy(buf+n,what,len);
|
||||||
|
n+=len;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rename_file (const char *fname,const char *target)
|
||||||
|
{
|
||||||
|
char *fpath;
|
||||||
|
unsigned int l;
|
||||||
|
UBUF *reply;
|
||||||
|
|
||||||
|
/* reset buffer */
|
||||||
|
n=0;
|
||||||
|
/* append source file */
|
||||||
|
fpath = util_abs_path(fname);
|
||||||
|
l=strlen(fpath)+1;
|
||||||
|
if(append_to_buf(fpath,l))
|
||||||
|
{
|
||||||
|
printf("path too long: %s.\n",fpath);
|
||||||
|
free(fpath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
free(fpath);
|
||||||
|
/* add dest */
|
||||||
|
fpath=util_abs_path(target);
|
||||||
|
l=strlen(fpath)+1;
|
||||||
|
if(append_to_buf(fpath,l))
|
||||||
|
{
|
||||||
|
printf("path too long: %s.\n",fpath);
|
||||||
|
free(fpath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* send our nicely crafted junk to the server */
|
||||||
|
reply=client_interact (CC_RENAME,0,n+l,buf,0,NULL);
|
||||||
|
|
||||||
|
if(reply->cmd==CC_ERR)
|
||||||
|
{
|
||||||
|
/* seems like we have really bad luck today */
|
||||||
|
printf("mv %s %s: %s\n",fname,target,reply->buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main (int argc, char ** argv)
|
||||||
|
{
|
||||||
|
char **av, *av2[2];
|
||||||
|
|
||||||
|
env_client();
|
||||||
|
|
||||||
|
if(argc>1)
|
||||||
|
{
|
||||||
|
for( optind=1; argc-1>optind ; optind++)
|
||||||
|
{
|
||||||
|
if(!(av = glob(argv[optind])))
|
||||||
|
{
|
||||||
|
av = av2;
|
||||||
|
av2[0] = argv[optind];
|
||||||
|
av2[1] = 0;
|
||||||
|
}
|
||||||
|
while(*av)
|
||||||
|
rename_file(*av++,argv[argc-1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr,"%s source target\n", argv[0]);
|
||||||
|
|
||||||
|
client_done();
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "printpro.h"
|
#include "printpro.h"
|
||||||
|
|
||||||
static int get_pro PROTO1(const char *, p)
|
static int get_pro (const char * p)
|
||||||
{
|
{
|
||||||
char *op;
|
char *op;
|
||||||
UBUF *ub;
|
UBUF *ub;
|
||||||
|
|
@ -40,7 +40,7 @@ static int get_pro PROTO1(const char *, p)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_pro PROTO2(char *, p, char *, key)
|
static int set_pro (char * p, char * key)
|
||||||
{
|
{
|
||||||
char *op;
|
char *op;
|
||||||
UBUF *ub;
|
UBUF *ub;
|
||||||
|
|
@ -59,7 +59,7 @@ static int set_pro PROTO2(char *, p, char *, key)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
char **av, *av2[2], *key;
|
char **av, *av2[2], *key;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,13 @@
|
||||||
static int timestamps=0;
|
static int timestamps=0;
|
||||||
static int optletter;
|
static int optletter;
|
||||||
|
|
||||||
static void usage PROTO0((void))
|
static void usage (void)
|
||||||
{
|
{
|
||||||
printf("fput");
|
printf("fput");
|
||||||
printf(" [-p | [ -h | -? ] ] file ...\n");
|
printf(" [-p | [ -h | -? ] ] file ...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int put_file PROTO1(char *, path)
|
static int put_file (char * path)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
char *name, *t2;
|
char *name, *t2;
|
||||||
|
|
@ -55,7 +55,7 @@ static int put_file PROTO1(char *, path)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
char n[1024];
|
char n[1024];
|
||||||
int prompt;
|
int prompt;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#include "my-string.h"
|
#include "my-string.h"
|
||||||
#include "merge.h"
|
#include "merge.h"
|
||||||
|
|
||||||
static int remove_it PROTO1(char *, p)
|
static int remove_it (char * p)
|
||||||
{
|
{
|
||||||
char *op;
|
char *op;
|
||||||
UBUF *ub;
|
UBUF *ub;
|
||||||
|
|
@ -37,7 +37,7 @@ static int remove_it PROTO1(char *, p)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
char **av, *av2[2];
|
char **av, *av2[2];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#include "my-string.h"
|
#include "my-string.h"
|
||||||
#include "merge.h"
|
#include "merge.h"
|
||||||
|
|
||||||
static int remove_it PROTO1(char *, p)
|
static int remove_it (char * p)
|
||||||
{
|
{
|
||||||
char *op;
|
char *op;
|
||||||
UBUF *ub;
|
UBUF *ub;
|
||||||
|
|
@ -38,7 +38,7 @@ static int remove_it PROTO1(char *, p)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
char **av, *av2[2];
|
char **av, *av2[2];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "my-string.h"
|
#include "my-string.h"
|
||||||
|
|
||||||
static void stat_file PROTO1(const char *,fname)
|
static void stat_file (const char *fname)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
struct tm *ftime;
|
struct tm *ftime;
|
||||||
|
|
@ -52,7 +52,7 @@ static void stat_file PROTO1(const char *,fname)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
char n[1024];
|
char n[1024];
|
||||||
int prompt;
|
int prompt;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
UBUF *ub;
|
UBUF *ub;
|
||||||
unsigned int len, tput = 0, len2;
|
unsigned int len, tput = 0, len2;
|
||||||
|
|
@ -70,7 +70,10 @@ int main PROTO2(int, argc, char **, argv)
|
||||||
{
|
{
|
||||||
tput=0;
|
tput=0;
|
||||||
tput = BB_READ2(v2);
|
tput = BB_READ2(v2);
|
||||||
printf("\tMax. packet size supported by server is %d bytes.\n",tput);
|
if (tput > 1024)
|
||||||
|
printf("\tMax. payload size supported by server is %d bytes.\n",tput);
|
||||||
|
else
|
||||||
|
printf("\tPayload size prefered by server is %d bytes.\n",tput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
#include "my-string.h"
|
#include "my-string.h"
|
||||||
#include "merge.h"
|
#include "merge.h"
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,18 +10,19 @@
|
||||||
/* spliting the prototypes from merge.c to merge.h */
|
/* spliting the prototypes from merge.c to merge.h */
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
int fcatcmd_main PROTO2(int, argc, char **, argv);
|
int fcatcmd_main (int argc, char ** argv);
|
||||||
int fcdcmd_main PROTO2(int, argc, char **, argv);
|
int fcdcmd_main (int argc, char ** argv);
|
||||||
int fgetcmd_main PROTO2(int, argc, char **, argv);
|
int fgetcmd_main (int argc, char ** argv);
|
||||||
int fgrabcmd_main PROTO2(int, argc, char **, argv);
|
int fgrabcmd_main (int argc, char ** argv);
|
||||||
int flscmd_main PROTO2(int, argc, char **, argv);
|
int flscmd_main (int argc, char ** argv);
|
||||||
int fmkdir_main PROTO2(int, argc, char **, argv);
|
int fmkdir_main (int argc, char ** argv);
|
||||||
int fprocmd_main PROTO2(int, argc, char **, argv);
|
int fprocmd_main (int argc, char ** argv);
|
||||||
int fput_main PROTO2(int, argc, char **, argv);
|
int fput_main (int argc, char ** argv);
|
||||||
int frmcmd_main PROTO2(int, argc, char **, argv);
|
int frmcmd_main (int argc, char ** argv);
|
||||||
int frmdircmd_main PROTO2(int, argc, char **, argv);
|
int frmdircmd_main (int argc, char ** argv);
|
||||||
int fver_main PROTO2(int, argc, char **, argv);
|
int fver_main (int argc, char ** argv);
|
||||||
int fducmd_main PROTO2(int, argc, char **, argv);
|
int fducmd_main (int argc, char ** argv);
|
||||||
int fhostcmd_main PROTO2(int, argc, char **, argv);
|
int fhostcmd_main (int argc, char ** argv);
|
||||||
int ffindcmd_main PROTO2(int, argc, char **, argv);
|
int ffindcmd_main (int argc, char ** argv);
|
||||||
int fstatcmd_main PROTO2(int, argc, char **, argv);
|
int fstatcmd_main (int argc, char ** argv);
|
||||||
|
int fmvcmd_main (int argc, char ** argv);
|
||||||
|
|
|
||||||
|
|
@ -23,17 +23,18 @@
|
||||||
#define N_or_Y(y) ((flags & (y)) ? "N" : "Y")
|
#define N_or_Y(y) ((flags & (y)) ? "N" : "Y")
|
||||||
#define Machine(y) ((flags & (y)) ? "YOU" : "other")
|
#define Machine(y) ((flags & (y)) ? "YOU" : "other")
|
||||||
|
|
||||||
int print_pro PROTO2(UBUF *, ub, FILE *, where)
|
int print_pro (UBUF * ub, FILE * where)
|
||||||
{
|
{
|
||||||
char flags;
|
char flags;
|
||||||
unsigned len, len1;
|
unsigned len, len1;
|
||||||
char *pro1, *pro2;
|
char *pro1, *pro2;
|
||||||
|
|
||||||
|
/* length of readme */
|
||||||
len = BB_READ2(ub->bb_len);
|
len = BB_READ2(ub->bb_len);
|
||||||
|
/* len1= size of extended protection data */
|
||||||
len1 = BB_READ4(ub->bb_pos);
|
len1 = BB_READ4(ub->bb_pos);
|
||||||
pro1 = ub->buf;
|
pro1 = ub->buf;
|
||||||
pro2 = ub->buf+len;
|
pro2 = ub->buf+len;
|
||||||
|
|
||||||
if(len1) {
|
if(len1) {
|
||||||
flags = *pro2;
|
flags = *pro2;
|
||||||
fprintf(where,"owner: %s, del: %s, create: %s, mkdir: %s, get: %s, list: %s, rename: %s.\n",
|
fprintf(where,"owner: %s, del: %s, create: %s, mkdir: %s, get: %s, list: %s, rename: %s.\n",
|
||||||
|
|
@ -41,7 +42,7 @@ int print_pro PROTO2(UBUF *, ub, FILE *, where)
|
||||||
Y_or_N(DIR_MKDIR), N_or_Y(DIR_GET), Y_or_N(DIR_LIST),
|
Y_or_N(DIR_MKDIR), N_or_Y(DIR_GET), Y_or_N(DIR_LIST),
|
||||||
Y_or_N(DIR_RENAME));
|
Y_or_N(DIR_RENAME));
|
||||||
}
|
}
|
||||||
fprintf(where,"%s", pro1);
|
if(len) fprintf(where,"%s", pro1);
|
||||||
fprintf(where,"\n");
|
fprintf(where,"\n");
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
int print_pro PROTO2(UBUF *, ub, FILE *, where);
|
int print_pro (UBUF * ub, FILE * where);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
|
||||||
int _x_udp PROTO2(const char *, bindaddress, unsigned short *, port)
|
int _x_udp (const char * bindaddress, unsigned short * port)
|
||||||
{
|
{
|
||||||
int f;
|
int f;
|
||||||
socklen_t len;
|
socklen_t len;
|
||||||
|
|
@ -55,7 +55,7 @@ int _x_udp PROTO2(const char *, bindaddress, unsigned short *, port)
|
||||||
return(f);
|
return(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _x_adr PROTO3(const char *, host, int, port, struct sockaddr_in *, his)
|
int _x_adr (const char *host, int port, struct sockaddr_in * his)
|
||||||
{
|
{
|
||||||
char myhost[128];
|
char myhost[128];
|
||||||
struct hostent *H;
|
struct hostent *H;
|
||||||
|
|
@ -83,7 +83,7 @@ int _x_adr PROTO3(const char *, host, int, port, struct sockaddr_in *, his)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int _x_select PROTO2(fd_set *, rf, long, tt) /* tt is in unit of ms */
|
int _x_select (fd_set * rf, long tt) /* tt is in unit of ms */
|
||||||
{
|
{
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
|
|
||||||
|
|
|
||||||
15
configure.ac
15
configure.ac
|
|
@ -1,6 +1,6 @@
|
||||||
dnl Process this file with autoconf to produce a working configure script.
|
dnl Process this file with autoconf to produce a working configure script.
|
||||||
dnl tested with autoconf 2.57
|
dnl tested with autoconf 2.57
|
||||||
AC_INIT(fsp,2.8.1b20,hsn@netmag.cz)
|
AC_INIT(fsp,2.8.1b21,hsn@netmag.cz)
|
||||||
AC_CONFIG_SRCDIR(server/main.c)
|
AC_CONFIG_SRCDIR(server/main.c)
|
||||||
AM_INIT_AUTOMAKE([dist-bzip2])
|
AM_INIT_AUTOMAKE([dist-bzip2])
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
|
|
@ -32,6 +32,10 @@ case $host_os in
|
||||||
*cygwin* ) AC_DEFINE(OS_CYGWIN,1,[Define if you are building for cygwin]) AC_MSG_RESULT(yes);;
|
*cygwin* ) AC_DEFINE(OS_CYGWIN,1,[Define if you are building for cygwin]) AC_MSG_RESULT(yes);;
|
||||||
* ) AC_MSG_RESULT(no);;
|
* ) AC_MSG_RESULT(no);;
|
||||||
esac
|
esac
|
||||||
|
AC_MSG_CHECKING([if we are building lamer pack])
|
||||||
|
AC_ARG_ENABLE(lamerpack,[Build for lamers],AC_DEFINE(LAMERPACK,1,[Define if you want to build for lamer disbled ppl]) AC_MSG_RESULT(YES),AC_MSG_RESULT(NO))
|
||||||
|
AC_MSG_CHECKING([if enable extra debug code])
|
||||||
|
AC_ARG_ENABLE(debug,[Enable client library debuging],AC_DEFINE(DEBUG,1,[Define if you want more debug messages]) AC_MSG_RESULT(YES),AC_MSG_RESULT(NO))
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AM_PROG_LEX
|
AM_PROG_LEX
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
|
|
@ -58,8 +62,8 @@ then
|
||||||
-Wno-system-headers -Wredundant-decls \
|
-Wno-system-headers -Wredundant-decls \
|
||||||
-Wmissing-noreturn -pedantic \
|
-Wmissing-noreturn -pedantic \
|
||||||
-Wlong-long -Wundef -Winline \
|
-Wlong-long -Wundef -Winline \
|
||||||
-Wno-unused-parameter
|
-Wno-unused-parameter \
|
||||||
# -Wunreachable-code -Wconversion
|
-Wunreachable-code -Wconversion
|
||||||
do
|
do
|
||||||
if $CC $i $ac_cv_prog_gcc_flags -c configure-dummy.c >/dev/null 2>&1
|
if $CC $i $ac_cv_prog_gcc_flags -c configure-dummy.c >/dev/null 2>&1
|
||||||
then ac_cv_prog_gcc_flags="$ac_cv_prog_gcc_flags $i"
|
then ac_cv_prog_gcc_flags="$ac_cv_prog_gcc_flags $i"
|
||||||
|
|
@ -71,7 +75,6 @@ rm -f configure-dummy.c configure-dummy.o
|
||||||
CFLAGS="$CFLAGS $ac_cv_prog_gcc_flags"
|
CFLAGS="$CFLAGS $ac_cv_prog_gcc_flags"
|
||||||
AC_SUBST(CFLAGS)
|
AC_SUBST(CFLAGS)
|
||||||
AC_AIX
|
AC_AIX
|
||||||
AC_C_PROTOTYPES
|
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AC_C_VOLATILE
|
AC_C_VOLATILE
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
|
|
@ -81,10 +84,6 @@ if test "${enable_maintainer_mode+set}" = set; then
|
||||||
CFLAGS="-g3 $ac_cv_prog_gcc_flags"
|
CFLAGS="-g3 $ac_cv_prog_gcc_flags"
|
||||||
AC_CHECK_LIB(efence,EF_Abort)
|
AC_CHECK_LIB(efence,EF_Abort)
|
||||||
fi
|
fi
|
||||||
AC_MSG_CHECKING([if enable extra debug code])
|
|
||||||
AC_ARG_ENABLE(debug,[Enable client library debuging],AC_DEFINE(DEBUG,1,[Define if you want more debug messages]) AC_MSG_RESULT(YES),AC_MSG_RESULT(NO))
|
|
||||||
AC_MSG_CHECKING([if we are building lamer pack])
|
|
||||||
AC_ARG_ENABLE(lamerpack,[Build for lamers],AC_DEFINE(LAMERPACK,1,[Define if you want to build for lamer disbled ppl]) AC_MSG_RESULT(YES),AC_MSG_RESULT(NO))
|
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(limits.h sys/syslimits.h errno.h)
|
AC_CHECK_HEADERS(limits.h sys/syslimits.h errno.h)
|
||||||
AC_CHECK_HEADERS(string.h memory.h strings.h unistd.h sys/resource.h utime.h)
|
AC_CHECK_HEADERS(string.h memory.h strings.h unistd.h sys/resource.h utime.h)
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,12 @@ Why you need it
|
||||||
|
|
||||||
- stealth operation
|
- stealth operation
|
||||||
- old proven software with 10 years history
|
- old proven software with 10 years history
|
||||||
|
- Elite SitEZ has non interrupted operation by
|
||||||
|
lamerz for more than 10 years!
|
||||||
- for EliTe only
|
- for EliTe only
|
||||||
- attack resistant
|
- 100% attack resistant
|
||||||
- lamerz hates it
|
- net adminz do not like it
|
||||||
|
- lamerz can not handle it
|
||||||
|
|
||||||
STuFF firSt!
|
STuFF firSt!
|
||||||
|
|
||||||
|
|
@ -39,17 +42,19 @@ Have it? Right.
|
||||||
|
|
||||||
Now rock!
|
Now rock!
|
||||||
|
|
||||||
There is a p-file fspd.exe. This is for stuff sharing.
|
There is a p-file fspd.exe. This is for stuff sharing. Server. You know.
|
||||||
Running this is easy:
|
Right. Running this is easy:
|
||||||
|
|
||||||
fspd.exe -d c:\your\stuff\to\share -p 53
|
fspd.exe -d c:\your\stuff\to\share -p 53
|
||||||
|
|
||||||
this number is important. Recommended numbers for stealth
|
this number is important. Recommended numbers for stealth
|
||||||
operation are: 53, 2090, 137-139, 13, 21, 80, 443
|
operation are: 53, 2090, 137-139, 13, 80, 443
|
||||||
|
|
||||||
You can be catched more easily with bad number, so chooze wisely. Rememmber,
|
You can be catched more easily with bad number, so chooze wisely. Rememmber,
|
||||||
some numbers like 2221 are used only by Elite! do not try it at
|
some numbers like 2221, 21, 2000, 2001 are used only by Elite!
|
||||||
home; bad thingz can hepen. you know. police will certainly
|
do not try it at home; bad thingz can hepen. you know. police will certainly
|
||||||
take a visit.
|
take a visit. Lamers can detect you more easily on this ports, so be
|
||||||
|
wise a little. Remember: You are c000l.
|
||||||
|
|
||||||
Get more stuff!
|
Get more stuff!
|
||||||
|
|
||||||
|
|
|
||||||
162
doc/PROTOCOL
162
doc/PROTOCOL
|
|
@ -1,7 +1,8 @@
|
||||||
FILE SERVICE PROTOCOL VERSION 2
|
FILE SERVICE PROTOCOL VERSION 2
|
||||||
|
FSP v2
|
||||||
|
|
||||||
Document version 0.11
|
Document version 0.13
|
||||||
Last updated 24 Oct 2004
|
Last updated 1 Nov 2004
|
||||||
|
|
||||||
Also known as
|
Also known as
|
||||||
File Slurping Protocol,
|
File Slurping Protocol,
|
||||||
|
|
@ -13,10 +14,15 @@
|
||||||
`FSP is what anonymous FTP *should* be'
|
`FSP is what anonymous FTP *should* be'
|
||||||
|
|
||||||
This document was created by Radim Kolar, because there is no RFC for
|
This document was created by Radim Kolar, because there is no RFC for
|
||||||
FSP. It was planed, but never comes out. Based on sources of FSP 2.8.1 Beta 13.
|
FSP. It was planed, but never comes out. See FSP Project Home page
|
||||||
|
http://fsp.sourceforge.net/ for up-to-date version of this document.
|
||||||
|
Also contact Radim Kolar with questions and if you need to help with
|
||||||
|
an implementation of this protocol in productivity environment.
|
||||||
|
|
||||||
This document is not copyrighted and is placed into public domain.
|
This document is not copyrighted and is placed into public domain.
|
||||||
|
|
||||||
Data formats used in this document
|
Data formats used in this document:
|
||||||
|
|
||||||
byte - unsigned 1 byte integer 0-255
|
byte - unsigned 1 byte integer 0-255
|
||||||
word - unsigned 2 byte integer 0-65535
|
word - unsigned 2 byte integer 0-65535
|
||||||
long - unsigned 4 byte integer 0-4294967295
|
long - unsigned 4 byte integer 0-4294967295
|
||||||
|
|
@ -24,37 +30,60 @@ Data formats used in this document
|
||||||
NULL - byte 00
|
NULL - byte 00
|
||||||
ASCIIZ - ASCII string terminated with one NULL (the same as used in C
|
ASCIIZ - ASCII string terminated with one NULL (the same as used in C
|
||||||
language)
|
language)
|
||||||
numbers are stored in network byte order (high byte first).
|
Numbers are stored packed in network byte order (high byte first).
|
||||||
|
hexadecimal (base 16) numbers have 0x prefix.
|
||||||
File or directory names uses '/' as directory separator, they do not
|
File or directory names uses '/' as directory separator, they do not
|
||||||
need to start or end with it. There are in ASCIIZ format.
|
need to start or end with it. There are in ASCIIZ format.
|
||||||
FSP servers starting from version 2.8 can have optional password
|
FSP servers starting from version 2.8 can have optional password
|
||||||
protection. To get password protected file, append '\n' followed
|
protection. To get password protected file, append '\n' followed
|
||||||
by password to filename.
|
by password to filename.
|
||||||
Numbers starting with 0x are in hexadecimal (base 16) notation.
|
|
||||||
|
|
||||||
Transport
|
Transport
|
||||||
|
|
||||||
FSP uses UDP datagrams as transport medium. Minimum UDP packet size (not
|
FSP uses UDP datagrams as standard transport medium for operation in
|
||||||
including size of UDP, IP and link layer headers) is 12 bytes, maximum UDP
|
Internet Networks.
|
||||||
packet size is 1024+12 bytes.
|
|
||||||
|
FSP protocol uses checksum and payload size, so it do not require
|
||||||
|
any underlying transport protocol and can be used as very simple
|
||||||
|
raw-protocol (for example for sending data over serial line). This
|
||||||
|
makes it very popular in embedded devices area, because it is
|
||||||
|
extremely easy to implement.
|
||||||
|
|
||||||
|
FSP packets can have an optional extra data area. For supporting
|
||||||
|
packets with this, underlying transport must make size of received
|
||||||
|
packet available to FSP protocol stack at server side. Without this
|
||||||
|
information, full support for extra data area is not possible.
|
||||||
|
|
||||||
|
Servers can still send extra data in reply to CC_VERSION and
|
||||||
|
CC_GET_PRO because length of extra data is recorded in position
|
||||||
|
field of FSP header. Clients must check this field, when checking
|
||||||
|
checksums of received packets of that kind and process these extra
|
||||||
|
bytes.
|
||||||
|
|
||||||
|
Minimum UDP packet size (not including size of UDP, IP and link
|
||||||
|
layer headers) is 12 bytes (FSP v2 header only), maximum standard
|
||||||
|
UDP packet size is 1024+12 bytes. Server can accept longer packets,
|
||||||
|
but must send longer packets only when requested by client. All
|
||||||
|
servers and clients must support receiving 1024+12 bytes long
|
||||||
|
packets.
|
||||||
|
|
||||||
Security
|
Security
|
||||||
|
|
||||||
Design
|
Design
|
||||||
|
|
||||||
FSP protocol was not designed to transfer secret data. It was designed as
|
FSP protocol was not designed to transfer secret data. It was
|
||||||
alternative protocol for providing lightweight access to collection of public
|
designed as alternative protocol for providing lightweight access to
|
||||||
files. FSP has the same user level of security as the anonymous FTP file
|
collection of public files. FSP has the same user level of security
|
||||||
server. FSP has better network level security, because it was designed
|
as the anonymous FTP file server. FSP has better network level
|
||||||
to ressist various denial-of-service attacks. FSP protocol v3 will be
|
security, because it was designed to resist various
|
||||||
designed to be fully secure. FSP3 will not be backward compatible with
|
denial-of-service attacks. FSP protocol v3 will be designed to be
|
||||||
FSP2.
|
fully secure. FSP3 will not be backward compatible with FSP2.
|
||||||
|
|
||||||
Passwords
|
Passwords
|
||||||
|
|
||||||
Recently, password support was added to protocol, because just
|
Recently, password support was added to protocol, because just too
|
||||||
too many people wants it and there were hacked version of FSP with
|
many people wants it and there were hacked version of FSP with
|
||||||
password support floating around. Passwords are transmited in clear
|
password support floating around. Passwords are transmitted in clear
|
||||||
text over network which makes them a weak protection for determined
|
text over network which makes them a weak protection for determined
|
||||||
intruder.
|
intruder.
|
||||||
|
|
||||||
|
|
@ -63,11 +92,12 @@ FSP Packet format:
|
||||||
DATA - size = defined in header (DATA_LENGTH)
|
DATA - size = defined in header (DATA_LENGTH)
|
||||||
XTRA DATA - size = packet_size - header_size (12) - DATA_LENGTH
|
XTRA DATA - size = packet_size - header_size (12) - DATA_LENGTH
|
||||||
|
|
||||||
Maximal data size DATA_LENGTH + XTRA_DATA length is 1024. Clients and servers
|
Size of data payload is DATA_LENGTH + XTRA_DATA length. Clients and
|
||||||
are not required to support XTRA DATA (but in current FSP implementation does).
|
servers are not required to support XTRA DATA (but current FSP
|
||||||
If XTRA DATA are provided, there must be also contained in MESSAGE_CHECKSUM.
|
implementation does). If XTRA DATA are provided, there must be also
|
||||||
|
contained in MESSAGE_CHECKSUM.
|
||||||
|
|
||||||
HEADER FORMAT (12 bytes)
|
FSP v2 HEADER FORMAT (12 bytes)
|
||||||
byte FSP_COMMAND
|
byte FSP_COMMAND
|
||||||
byte MESSAGE_CHECKSUM
|
byte MESSAGE_CHECKSUM
|
||||||
word KEY
|
word KEY
|
||||||
|
|
@ -76,12 +106,13 @@ HEADER FORMAT (12 bytes)
|
||||||
long FILE_POSITION
|
long FILE_POSITION
|
||||||
|
|
||||||
MESSAGE_CHECKSUM
|
MESSAGE_CHECKSUM
|
||||||
Entire packet (HEADER + DATA + XTRA DATA) is checksumed. When computing a
|
Entire packet (HEADER + DATA + XTRA DATA) is checksummed. When computing a
|
||||||
checksum use zero in place of MESSAGE_CHECKSUM header field.
|
checksum use zero in place of MESSAGE_CHECKSUM header field.
|
||||||
|
|
||||||
Due to some unknown reason, method of computing checksums is different in each
|
Due to some unknown reason, method of computing checksums is different
|
||||||
direction. For packets travelling from server to client initial checksum
|
in each direction. For packets traveling from server to client initial
|
||||||
value is zero, otherwise it is HEADER + DATA + XTRA DATA size.
|
checksum value is zero, otherwise it is HEADER + DATA + XTRA DATA
|
||||||
|
size.
|
||||||
|
|
||||||
Checksums in server->client direction are computed as follows:
|
Checksums in server->client direction are computed as follows:
|
||||||
|
|
||||||
|
|
@ -90,22 +121,32 @@ Checksums in server->client direction are computed as follows:
|
||||||
for(t = packet_start, sum = 0; t < packet_end; sum += *t++);
|
for(t = packet_start, sum = 0; t < packet_end; sum += *t++);
|
||||||
checksum= sum + (sum >> 8);
|
checksum= sum + (sum >> 8);
|
||||||
|
|
||||||
|
One byte checksums can be considered weak when compared with other
|
||||||
|
protocols, which are using at least CRC16 checksum types. FSP server
|
||||||
|
fed by random data can resist for hours without falsely accepting
|
||||||
|
random data as valid FSP packet. This demonstration shows, that these
|
||||||
|
checksums when very easy to compute, are sufficient for guarding
|
||||||
|
against line noise.
|
||||||
|
|
||||||
KEY
|
KEY
|
||||||
Client's message to server contain a KEY value that is the same as the KEY
|
Client's message to server contain a KEY value that is the same as the KEY
|
||||||
value of the previous message received from the server. KEY is choosen random
|
value of the previous message received from the server. KEY is chosen random
|
||||||
by server.
|
by server.
|
||||||
|
|
||||||
TIMEOUTS
|
TIMEOUTS
|
||||||
Resends:
|
1. Resend
|
||||||
Server will accept resent message from client with old KEY after 3 seconds.
|
|
||||||
Client MUST wait at least 1 second before resending a message.
|
Server will accept resent message from client with old KEY after 3
|
||||||
It is recommended to use initial delay of 1.34 second and after each
|
seconds. Client MUST wait at least 1 second before resending a
|
||||||
unsuccessfull resend multiply delay time by 1.5. Maximum recommended delay
|
message. It is recommended to use initial delay of 1.34 second and
|
||||||
time is 300 seconds.
|
after each unsuccessful resend multiply delay time by 1.5. Maximum
|
||||||
Session:
|
delay time is 300 seconds.
|
||||||
Server will accept message with bad key after 60 seconds. Clients should
|
|
||||||
sent CC_BYE at end of their session, CC_BYE terminates a session.
|
2. Session
|
||||||
After session is terminated, sever will accept any next key.
|
|
||||||
|
Server will accept message with bad key after 60 seconds. Clients
|
||||||
|
should sent CC_BYE at end of their session, CC_BYE terminates a
|
||||||
|
session. After session is terminated, sever will accept any next key.
|
||||||
|
|
||||||
SEQUENCE
|
SEQUENCE
|
||||||
Similarly, the server's message to client contains a SEQUENCE value
|
Similarly, the server's message to client contains a SEQUENCE value
|
||||||
|
|
@ -119,7 +160,7 @@ size of this field is not included in header and must be computed from
|
||||||
received packet size.
|
received packet size.
|
||||||
|
|
||||||
FILE POSITION
|
FILE POSITION
|
||||||
When transfering files, this field shows current position of requested
|
When transferring files, this field shows current position of requested
|
||||||
data.
|
data.
|
||||||
|
|
||||||
FSP COMMANDS
|
FSP COMMANDS
|
||||||
|
|
@ -152,14 +193,22 @@ FSP File servers MUST supports following commands:
|
||||||
bit 2 set - reverse lookup required
|
bit 2 set - reverse lookup required
|
||||||
bit 3 set - server is in private mode
|
bit 3 set - server is in private mode
|
||||||
bit 4 set - thruput control
|
bit 4 set - thruput control
|
||||||
|
bit 5 set - server accept XTRA
|
||||||
|
DATA on input
|
||||||
|
|
||||||
if bit 4 is set thruput info follows
|
if bit 4 is set thruput info follows
|
||||||
long - max_thruput allowed (in bytes/sec)
|
long - max_thruput allowed (in bytes/sec)
|
||||||
word - max. packet size supported by server
|
word - max. payload size supported by server
|
||||||
|
if > 1024, otherwise preferred
|
||||||
|
payload size.
|
||||||
|
|
||||||
Compatibility
|
Compatibility
|
||||||
|
|
||||||
Max. packet size supported is reported only by fspd 2.8.1 b20
|
Max. / preferred packet size supported is reported only
|
||||||
or newer.
|
by fspd 2.8.1 b20 or newer.
|
||||||
|
|
||||||
|
Bit 5 - accept xtra data flag is set only by fspd
|
||||||
|
2.8.1 b21 or newer.
|
||||||
|
|
||||||
CC_ERR 0x40 - error response from server
|
CC_ERR 0x40 - error response from server
|
||||||
|
|
||||||
|
|
@ -184,7 +233,7 @@ FSP File servers MUST supports following commands:
|
||||||
file position: position in directory
|
file position: position in directory
|
||||||
data: ASCIIZ directory name
|
data: ASCIIZ directory name
|
||||||
xtra data: (not required)
|
xtra data: (not required)
|
||||||
word - prefered size of directory block
|
word - preferred size of directory block
|
||||||
|
|
||||||
reply
|
reply
|
||||||
file position: same as in request
|
file position: same as in request
|
||||||
|
|
@ -197,8 +246,8 @@ which can be shorter. Default and maximum size of directory listing block is
|
||||||
1024 bytes. Size of directory block can be changed by server using extra
|
1024 bytes. Size of directory block can be changed by server using extra
|
||||||
data information sent by client.
|
data information sent by client.
|
||||||
|
|
||||||
Directory blocks can't be split accross message boundary and client
|
Directory blocks can't be split across message boundary and client
|
||||||
can't do seeking to any arbitary offset, which can broke dirblock
|
can't do seeking to any arbitrary offset, which can broke dirblock
|
||||||
into 2 messages. In short: Every message can contain only one
|
into 2 messages. In short: Every message can contain only one
|
||||||
unsplited directory block.
|
unsplited directory block.
|
||||||
|
|
||||||
|
|
@ -208,14 +257,16 @@ standard format, a 4 bytes quantity 'size', and 1 byte of 'type'. Header is
|
||||||
followed by ASCIIZ encoded 'name'. RDIRENT is followed by enough number of
|
followed by ASCIIZ encoded 'name'. RDIRENT is followed by enough number of
|
||||||
padding to fill to an 4-byte boundary.
|
padding to fill to an 4-byte boundary.
|
||||||
|
|
||||||
At this point, if the next RDIRENT entry to follow will spread across 1k
|
At this point, if the next RDIRENT entry to follow will spread across
|
||||||
boundary, then two possible things will happen:
|
directory block boundary, then two possible things will happen:
|
||||||
|
|
||||||
1) if the HEADER fits between this entry and the 1k boundary,
|
1) if the HEADER fits between this entry and the directory block
|
||||||
a complete header will be filled in with a 'type' set to RDTYPE_SKIP
|
boundary, a complete header will be filled in with a 'type' set to
|
||||||
and no name followed - just pad to 1k boundary. Clients which sees
|
RDTYPE_SKIP and no name followed - just pad to boundary. Clients
|
||||||
RDTYPE_SKIP header skips over next data in packet.
|
which sees RDTYPE_SKIP header skips over remaining data in packet.
|
||||||
2) if the HEADER does not fit, then simply pad to the 1k boundary.
|
|
||||||
|
2) if the HEADER does not fit, then simply pad to the directory
|
||||||
|
block boundary.
|
||||||
|
|
||||||
This will make sure that messages carrying directory information carry only
|
This will make sure that messages carrying directory information carry only
|
||||||
complete directory entries and no fragmented entries.
|
complete directory entries and no fragmented entries.
|
||||||
|
|
@ -310,7 +361,7 @@ RDIRENT.HEADER types:
|
||||||
reply
|
reply
|
||||||
file position: number of extra protection bytes (now 1)
|
file position: number of extra protection bytes (now 1)
|
||||||
data: ASCIIZ directory readme
|
data: ASCIIZ directory readme
|
||||||
xtra data: extra protection data (format follows)
|
xtra data: protection data (format follows)
|
||||||
|
|
||||||
Protection bits:
|
Protection bits:
|
||||||
0 - caller owns the directory
|
0 - caller owns the directory
|
||||||
|
|
@ -328,6 +379,7 @@ RDIRENT.HEADER types:
|
||||||
causes that directory can be listable even it do not have
|
causes that directory can be listable even it do not have
|
||||||
6th bit set.
|
6th bit set.
|
||||||
|
|
||||||
|
|
||||||
CC_SET_PRO 0x48 - set directory protection
|
CC_SET_PRO 0x48 - set directory protection
|
||||||
|
|
||||||
request
|
request
|
||||||
|
|
@ -382,7 +434,7 @@ Commands starting from FSP version 2.4 ( released March 27, 1992 )
|
||||||
CC_GRAB_FILE 0x4B - atomic get+delete a file
|
CC_GRAB_FILE 0x4B - atomic get+delete a file
|
||||||
|
|
||||||
same format as CC_GET_FILE, but file is deleted after
|
same format as CC_GET_FILE, but file is deleted after
|
||||||
sucessfull transfer is done. If there are multiple
|
successful transfer is done. If there are multiple
|
||||||
grabs for the same file, only one will succeed.
|
grabs for the same file, only one will succeed.
|
||||||
|
|
||||||
CC_GRAB_DONE 0x4C - atomic get+delete a file done
|
CC_GRAB_DONE 0x4C - atomic get+delete a file done
|
||||||
|
|
@ -448,3 +500,5 @@ Reserved commands:
|
||||||
header will be used in protocol version 3.
|
header will be used in protocol version 3.
|
||||||
|
|
||||||
CC_TEST 0x81 - reserved for testing of new header
|
CC_TEST 0x81 - reserved for testing of new header
|
||||||
|
|
||||||
|
ignore this line vi: tw=70
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
|
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [
|
||||||
<!-- define some ENTITYs -->
|
<!-- define some ENTITYs -->
|
||||||
<!ENTITY fsp "File Service Protocol">
|
<!ENTITY fsp "File Service Protocol">
|
||||||
]>
|
]>
|
||||||
|
|
@ -542,6 +542,19 @@
|
||||||
fine-tune its retry algorithm
|
fine-tune its retry algorithm
|
||||||
by computing packet loss ratio of network, and duplicate
|
by computing packet loss ratio of network, and duplicate
|
||||||
packet rate.
|
packet rate.
|
||||||
|
<sect2>
|
||||||
|
<title>Why not use bigger packet size?</title>
|
||||||
|
<para>
|
||||||
|
&fsp; defines maximum packet size 1024 bytes of data + header.
|
||||||
|
Because MTU of most networks is about 1500 bytes. It is true, that
|
||||||
|
we can use slightly bigger packets for gaining some speed.
|
||||||
|
We have performed some benchmarks and they shows only minor
|
||||||
|
performance increase, about 10-15 percent. Similar testing
|
||||||
|
was performed by HP in <ulink url="http://www.ietf.org/rfc/rfc2348.txt">RFC 2348</ulink>.
|
||||||
|
<para>
|
||||||
|
For bigger performance enhancement we need to use at least 2KB,
|
||||||
|
but packets of that size must be fragmented on most network and fragmenting increases possibility of packet loss. We will not increase packet size
|
||||||
|
in FSP v2, but we are willing to do some experiments in FSP v3.
|
||||||
</sect1>
|
</sect1>
|
||||||
</article>
|
</article>
|
||||||
<!-- vim: set expandtab: -->
|
<!-- vim: set expandtab: -->
|
||||||
|
|
|
||||||
15
fspd.conf
15
fspd.conf
|
|
@ -7,8 +7,13 @@
|
||||||
# This is NOT needed if running under inetd, but otherwise is required.
|
# This is NOT needed if running under inetd, but otherwise is required.
|
||||||
# Standard port for FSP is 21, other popular ports are 2001 and 2000.
|
# Standard port for FSP is 21, other popular ports are 2001 and 2000.
|
||||||
# Please run official FSP sites on port 21.
|
# Please run official FSP sites on port 21.
|
||||||
|
#
|
||||||
# If you want a random port from 1024 - 65535 range, set port to 65535
|
# If you want a random port from 1024 - 65535 range, set port to 65535
|
||||||
#
|
#
|
||||||
|
# ================================================================
|
||||||
|
# If you want to avoid detection by lamer security scanner nessus
|
||||||
|
# do not use ports: 21, 2000 and 2221.
|
||||||
|
# ================================================================
|
||||||
port 21
|
port 21
|
||||||
|
|
||||||
# Server can listen only on particular network interface
|
# Server can listen only on particular network interface
|
||||||
|
|
@ -38,7 +43,7 @@ homedir_restricted yes
|
||||||
|
|
||||||
# 'use_access_files' if server should check for special .FSP files
|
# 'use_access_files' if server should check for special .FSP files
|
||||||
# in directory and set access rights acording to that.
|
# in directory and set access rights acording to that.
|
||||||
# In most installation, yes is right. Use `no` if people can uload
|
# In most installation, yes is right. Use `no` if people can upload
|
||||||
# files starting with .FSP into fsp server homedir.
|
# files starting with .FSP into fsp server homedir.
|
||||||
use_access_files yes
|
use_access_files yes
|
||||||
|
|
||||||
|
|
@ -60,8 +65,9 @@ pidlogname /var/run/fspd.pid
|
||||||
# The 'grabcommand' can turn grab command on or off.
|
# The 'grabcommand' can turn grab command on or off.
|
||||||
grabcommand on
|
grabcommand on
|
||||||
|
|
||||||
# The 'vercommand' can turn fver command on or off. Many FSP scanners
|
# The 'vercommand' can turn fver command on or off. All known FSP scanners
|
||||||
# are using this command as detection of FSP presence
|
# are using this command as detection of FSP presence.
|
||||||
|
# vercommand must be disabled for stealth operation. Yes, lamers sucks.
|
||||||
vercommand on
|
vercommand on
|
||||||
|
|
||||||
# The 'readme' commands specifies the name of the local readme file
|
# The 'readme' commands specifies the name of the local readme file
|
||||||
|
|
@ -129,7 +135,8 @@ logfile ../logs/logfile
|
||||||
log all !readonly
|
log all !readonly
|
||||||
|
|
||||||
#The 'xferlog' command tells server where to use wuftpd compatible
|
#The 'xferlog' command tells server where to use wuftpd compatible
|
||||||
#transfer log file. Thos logs currectly do not support partial transfers.
|
#transfer log file. Loging substem currectly do not support
|
||||||
|
#recording of partial transfers.
|
||||||
xferlog ../logs/xferlog
|
xferlog ../logs/xferlog
|
||||||
|
|
||||||
# The 'thruput' command is used to specify the maximum average
|
# The 'thruput' command is used to specify the maximum average
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
noinst_HEADERS=bsd_extern.h c_extern.h client_conf.h client_def.h co_extern.h \
|
noinst_HEADERS=bsd_extern.h c_extern.h client_conf.h client_def.h co_extern.h \
|
||||||
common_def.h find.h ls.h my-string.h proto.h s_extern.h server_conf.h \
|
common_def.h find.h ls.h my-string.h s_extern.h server_conf.h \
|
||||||
server_def.h tweak.h
|
server_def.h tweak.h
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,6 @@
|
||||||
#define _FSP_BSD_EXTERN_H_ 1
|
#define _FSP_BSD_EXTERN_H_ 1
|
||||||
|
|
||||||
/* glob.c */
|
/* glob.c */
|
||||||
char **glob PROTO0((register char *));
|
char **glob (register char *);
|
||||||
|
|
||||||
#endif /* _FSP_BSD_EXTERN_H_ */
|
#endif /* _FSP_BSD_EXTERN_H_ */
|
||||||
|
|
|
||||||
|
|
@ -4,40 +4,41 @@
|
||||||
/* lib.c */
|
/* lib.c */
|
||||||
extern int client_trace;
|
extern int client_trace;
|
||||||
extern unsigned long udp_sent_time,target_delay,target_maxdelay;
|
extern unsigned long udp_sent_time,target_delay,target_maxdelay;
|
||||||
UBUF *client_interact PROTO0((unsigned char, unsigned long, unsigned int,
|
UBUF *client_interact (unsigned char, unsigned long, unsigned int,
|
||||||
unsigned const char *, unsigned int,
|
unsigned const char *, unsigned int,
|
||||||
unsigned const char *));
|
unsigned const char *);
|
||||||
void init_client PROTO0((const char *, unsigned short, unsigned short));
|
void init_client (const char *, unsigned short, unsigned short);
|
||||||
int client_done PROTO0((void));
|
int client_done (void);
|
||||||
|
|
||||||
/* lock.c */
|
/* lock.c */
|
||||||
extern int key_persists;
|
extern int key_persists;
|
||||||
unsigned short client_get_key PROTO0((void));
|
unsigned short client_get_key (void);
|
||||||
void client_set_key PROTO0((unsigned short));
|
void client_set_key (unsigned short);
|
||||||
void client_destroy_key PROTO0((void));
|
void client_destroy_key (void);
|
||||||
void client_init_key PROTO0((unsigned long, unsigned long,
|
void client_init_key (unsigned long, unsigned long,
|
||||||
unsigned short));
|
unsigned short);
|
||||||
|
|
||||||
/* util.c */
|
/* util.c */
|
||||||
extern const char *env_dir,*env_passwd,*env_local_dir,*env_port,*env_myport,*env_host,*env_listen_on;
|
extern const char *env_dir,*env_passwd,*env_local_dir,*env_port,*env_myport,*env_host,*env_listen_on;
|
||||||
extern unsigned int env_timeout;
|
extern unsigned int env_timeout;
|
||||||
extern unsigned short client_buf_len,client_net_len;
|
extern unsigned short client_buf_len,client_net_len;
|
||||||
char *util_abs_path PROTO0((const char *));
|
char *util_abs_path (const char *);
|
||||||
char *util_getwd PROTO0((char *));
|
void util_junk_password(char *path);
|
||||||
int util_download PROTO0((char *, FILE *, unsigned long));
|
char *util_getwd (char *);
|
||||||
int util_grab_file PROTO0((char *, FILE *, unsigned long));
|
int util_download (char *, FILE *, unsigned long);
|
||||||
int util_upload PROTO0((char *, FILE *, time_t));
|
int util_grab_file (char *, FILE *, unsigned long);
|
||||||
void env_client PROTO0((void));
|
int util_upload (char *, FILE *, time_t);
|
||||||
RDIR *util_opendir PROTO0((char *));
|
void env_client (void);
|
||||||
void util_closedir PROTO0((RDIR *));
|
RDIR *util_opendir (char *);
|
||||||
rdirent *util_readdir PROTO0((RDIR *));
|
void util_closedir (RDIR *);
|
||||||
int util_stat PROTO0((char *, struct stat *));
|
rdirent *util_readdir (RDIR *);
|
||||||
int util_cd PROTO0((char *));
|
int util_stat (char *, struct stat *);
|
||||||
int util_cd2 PROTO0((char *));
|
int util_cd (char *);
|
||||||
void util_process_file PROTO0((char *, int,
|
int util_cd2 (char *);
|
||||||
void (*)PROTO0((char *,struct stat *,int,int)),
|
void util_process_file (char *, int,
|
||||||
int (*)PROTO0((char *,struct stat *,u_long *)),
|
void (*)(char *,struct stat *,int,int),
|
||||||
void (*)PROTO0((char *,int,u_long,int)),
|
int (*)(char *,struct stat *,u_long *),
|
||||||
int));
|
void (*)(char *,int,u_long,int),
|
||||||
|
int);
|
||||||
|
|
||||||
#endif /* _FSP_C_EXTERN_H_ */
|
#endif /* _FSP_C_EXTERN_H_ */
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,25 @@
|
||||||
#ifndef _FSP_CO_EXTERN_H_
|
#ifndef _FSP_CO_EXTERN_H_
|
||||||
#define _FSP_CO_EXTERN_H_ 1
|
#define _FSP_CO_EXTERN_H_ 1
|
||||||
|
|
||||||
|
/* common routines for both server and clients */
|
||||||
|
|
||||||
#ifndef HAVE_STRDUP
|
#ifndef HAVE_STRDUP
|
||||||
/* strdup.c */
|
/* strdup.c */
|
||||||
char *strdup PROTO0((char *));
|
char *strdup (const char *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_RANDOM
|
#ifndef HAVE_RANDOM
|
||||||
/* random.c */
|
/* random.c */
|
||||||
void srandom PROTO0((unsigned int));
|
void srandom (unsigned int);
|
||||||
char *initstate PROTO0((unsigned int, char *, int));
|
char *initstate (unsigned int, char *, int);
|
||||||
char *setstate PROTO0((char *));
|
char *setstate (char *);
|
||||||
long random PROTO0((void));
|
long random (void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* udp_io.c */
|
/* udp_io.c */
|
||||||
int _x_udp PROTO0((const char *, unsigned short *));
|
int _x_udp (const char *, unsigned short *);
|
||||||
int _x_adr PROTO0((const char *, int, struct sockaddr_in *));
|
int _x_adr (const char *, int, struct sockaddr_in *);
|
||||||
int _x_select PROTO0((fd_set *, long));
|
int _x_select (fd_set *, long);
|
||||||
|
|
||||||
/* getsl.c */
|
/* getsl.c */
|
||||||
char *getsl(char *s, int l);
|
char *getsl(char *s, int l);
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,7 @@ typedef struct UBUF { unsigned char cmd; /* message code. */
|
||||||
#define VER_REVNAME 0x04 /* does the server refuse non reversables */
|
#define VER_REVNAME 0x04 /* does the server refuse non reversables */
|
||||||
#define VER_PRIVMODE 0x08 /* Is the server being run 'private' mode */
|
#define VER_PRIVMODE 0x08 /* Is the server being run 'private' mode */
|
||||||
#define VER_THRUPUT 0x10 /* does the server enforce thruput control*/
|
#define VER_THRUPUT 0x10 /* does the server enforce thruput control*/
|
||||||
|
#define VER_XTRADATA 0x20 /* server accept packets with xtra data */
|
||||||
|
|
||||||
/* definition of directory bitfield for directory information */
|
/* definition of directory bitfield for directory information */
|
||||||
/* directory information is just going to be a bitfield encoding
|
/* directory information is just going to be a bitfield encoding
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ enum ntype {
|
||||||
/* node definition */
|
/* node definition */
|
||||||
typedef struct _plandata {
|
typedef struct _plandata {
|
||||||
struct _plandata *next; /* next node */
|
struct _plandata *next; /* next node */
|
||||||
int (*eval) PROTO0((struct _plandata *, struct stat *, char *)); /* node evaluation function */
|
int (*eval) (struct _plandata *, struct stat *, char *); /* node evaluation function */
|
||||||
int flags; /* private flags */
|
int flags; /* private flags */
|
||||||
enum ntype type; /* plan node type */
|
enum ntype type; /* plan node type */
|
||||||
union {
|
union {
|
||||||
|
|
@ -98,34 +98,34 @@ typedef struct _option {
|
||||||
} OPTION;
|
} OPTION;
|
||||||
|
|
||||||
/* find.c */
|
/* find.c */
|
||||||
void find_formplan PROTO0((char **));
|
void find_formplan (char **);
|
||||||
|
|
||||||
/* fnmatch.c */
|
/* fnmatch.c */
|
||||||
int fnmatch PROTO0((register char *, register char *));
|
int fnmatch (register char *, register char *);
|
||||||
|
|
||||||
/* function.c */
|
/* function.c */
|
||||||
PLAN * c_time PROTO0((char *));
|
PLAN * c_time (char *);
|
||||||
PLAN *c_exec PROTO0((char ***, int));
|
PLAN *c_exec (char ***, int);
|
||||||
PLAN *c_ls PROTO0((void));
|
PLAN *c_ls (void);
|
||||||
PLAN *c_name PROTO0((char *));
|
PLAN *c_name (char *);
|
||||||
PLAN *c_newer PROTO0((char *));
|
PLAN *c_newer (char *);
|
||||||
PLAN *c_print PROTO0((void));
|
PLAN *c_print (void);
|
||||||
PLAN *c_prune PROTO0((void));
|
PLAN *c_prune (void);
|
||||||
PLAN *c_size PROTO0((char *));
|
PLAN *c_size (char *);
|
||||||
PLAN *c_type PROTO0((char *));
|
PLAN *c_type (char *);
|
||||||
int find_expr PROTO0((PLAN *, struct stat *, char *));
|
int find_expr (PLAN *, struct stat *, char *);
|
||||||
PLAN *c_openparen PROTO0((void));
|
PLAN *c_openparen (void);
|
||||||
PLAN *c_closeparen PROTO0((void));
|
PLAN *c_closeparen (void);
|
||||||
PLAN *c_not PROTO0((void));
|
PLAN *c_not (void);
|
||||||
PLAN *c_or PROTO0((void));
|
PLAN *c_or (void);
|
||||||
|
|
||||||
/* operator.c */
|
/* operator.c */
|
||||||
PLAN *paren_squish PROTO0((PLAN *));
|
PLAN *paren_squish (PLAN *);
|
||||||
PLAN *not_squish PROTO0((PLAN *));
|
PLAN *not_squish (PLAN *);
|
||||||
PLAN *or_squish PROTO0((PLAN *));
|
PLAN *or_squish (PLAN *);
|
||||||
|
|
||||||
/* options.c */
|
/* options.c */
|
||||||
PLAN *find_create PROTO0((char ***));
|
PLAN *find_create (char ***);
|
||||||
OPTION *option PROTO0((char *));
|
OPTION *option (char *);
|
||||||
|
|
||||||
#endif /* _FSP_FIND_H_ */
|
#endif /* _FSP_FIND_H_ */
|
||||||
|
|
|
||||||
34
include/ls.h
34
include/ls.h
|
|
@ -52,30 +52,30 @@ extern int f_total; /* if precede with "total" line */
|
||||||
extern int f_type; /* add type character for non-regular files */
|
extern int f_type; /* add type character for non-regular files */
|
||||||
|
|
||||||
/* cmp.c */
|
/* cmp.c */
|
||||||
int namecmp PROTO0((LS *, LS *));
|
int namecmp (LS *, LS *);
|
||||||
int revnamecmp PROTO0((LS *, LS *));
|
int revnamecmp (LS *, LS *);
|
||||||
int modcmp PROTO0((LS *, LS *));
|
int modcmp (LS *, LS *);
|
||||||
int revmodcmp PROTO0((LS *, LS *));
|
int revmodcmp (LS *, LS *);
|
||||||
int acccmp PROTO0((LS *, LS *));
|
int acccmp (LS *, LS *);
|
||||||
int revacccmp PROTO0((LS *, LS *));
|
int revacccmp (LS *, LS *);
|
||||||
int statcmp PROTO0((LS *, LS *));
|
int statcmp (LS *, LS *);
|
||||||
int revstatcmp PROTO0((LS *, LS *));
|
int revstatcmp (LS *, LS *);
|
||||||
|
|
||||||
/* ls.c */
|
/* ls.c */
|
||||||
void fls_main PROTO0((int, char **));
|
void fls_main (int, char **);
|
||||||
|
|
||||||
/* print.c */
|
/* print.c */
|
||||||
void printscol PROTO0((LS *, int));
|
void printscol (LS *, int);
|
||||||
void printlong PROTO0((LS *, int));
|
void printlong (LS *, int);
|
||||||
void printcol PROTO0((LS *, int));
|
void printcol (LS *, int);
|
||||||
|
|
||||||
/* util.c */
|
/* util.c */
|
||||||
void prcopy PROTO0((char *, char *, int));
|
void prcopy (char *, char *, int);
|
||||||
char *emalloc PROTO0((int));
|
char *emalloc (int);
|
||||||
void nomem PROTO0((void));
|
void nomem (void);
|
||||||
void usage PROTO0((void));
|
void usage (void);
|
||||||
|
|
||||||
/* clients/flscmd.c */
|
/* clients/flscmd.c */
|
||||||
int ls_bad PROTO0((int));
|
int ls_bad (int);
|
||||||
|
|
||||||
#endif /* _FSP_LS_H_ */
|
#endif /* _FSP_LS_H_ */
|
||||||
|
|
|
||||||
|
|
@ -18,76 +18,76 @@ extern char *listen_on;
|
||||||
extern unsigned int dir_cache_limit, stat_cache_limit,fp_cache_limit;
|
extern unsigned int dir_cache_limit, stat_cache_limit,fp_cache_limit;
|
||||||
extern char *tmp_dir;
|
extern char *tmp_dir;
|
||||||
extern mode_t upload_umask, system_umask;
|
extern mode_t upload_umask, system_umask;
|
||||||
void load_configuration PROTO1(const char *, conffile);
|
void load_configuration (const char * conffile);
|
||||||
void destroy_configuration PROTO0((void));
|
void destroy_configuration (void);
|
||||||
|
|
||||||
/* file.c, file based disk i/o operations */
|
/* file.c, file based disk i/o operations */
|
||||||
int init_caches PROTO0((void));
|
int init_caches (void);
|
||||||
void shutdown_caches PROTO0((void));
|
void shutdown_caches (void);
|
||||||
void stat_caches PROTO1(FILE *,fp);
|
void stat_caches (FILE *fp);
|
||||||
const char *validate_path PROTO0((char *, unsigned, PPATH *,DIRINFO **, int));
|
const char *validate_path (char *, unsigned, PPATH *,DIRINFO **, int);
|
||||||
const char *server_get_dir PROTO0((DIRLISTING **,const DIRINFO *));
|
const char *server_get_dir (DIRLISTING **,const DIRINFO *);
|
||||||
const char *server_del_file PROTO0((PPATH *, DIRINFO *));
|
const char *server_del_file (PPATH *, DIRINFO *);
|
||||||
const char *server_del_dir PROTO2(PPATH *, pp, DIRINFO *,di);
|
const char *server_del_dir (PPATH * pp, DIRINFO * di);
|
||||||
const char *server_make_dir PROTO0((PPATH *, unsigned long,DIRINFO **));
|
const char *server_make_dir (PPATH *, unsigned long,DIRINFO **);
|
||||||
const char *server_get_file PROTO0((PPATH *, FILE **, unsigned long,
|
const char *server_get_file (PPATH *, FILE **, unsigned long,
|
||||||
unsigned short,DIRINFO *));
|
unsigned short,DIRINFO *);
|
||||||
const char *server_get_pro PROTO3(DIRINFO *, di, char *, result, const char *, acc);
|
int server_get_pro (DIRINFO * di, char * result, const char * acc);
|
||||||
const char *server_set_pro PROTO2(DIRINFO *,di, const char *, key);
|
const char *server_set_pro (DIRINFO * di, const char * key);
|
||||||
const char *server_up_load PROTO0((char *, unsigned int, unsigned long, unsigned long,
|
const char *server_up_load (char *, unsigned int, unsigned long, unsigned long,
|
||||||
unsigned short));
|
unsigned short);
|
||||||
const char *server_install PROTO0((PPATH *, unsigned long, unsigned short,const char *,DIRINFO *,unsigned int,const char *));
|
const char *server_install (PPATH *, unsigned long, unsigned short,const char *,DIRINFO *,unsigned int,const char *);
|
||||||
const char *server_secure_file PROTO0((PPATH *, unsigned long,
|
const char *server_secure_file (PPATH *, unsigned long,
|
||||||
unsigned short,DIRINFO *));
|
unsigned short,DIRINFO *);
|
||||||
const char *server_grab_file PROTO0((FILE **, unsigned long,
|
const char *server_grab_file (FILE **, unsigned long,
|
||||||
unsigned short));
|
unsigned short);
|
||||||
const char *server_grab_done PROTO0((unsigned long, unsigned short));
|
const char *server_grab_done (unsigned long, unsigned short);
|
||||||
const char *server_stat PROTO1(UBUF *, buf);
|
const char *server_stat (UBUF * buf);
|
||||||
const char *server_rename PROTO0((char *,unsigned int,unsigned int));
|
const char *server_rename (char *,unsigned int,unsigned long);
|
||||||
void init_home_dir PROTO0((void));
|
void init_home_dir (void);
|
||||||
|
|
||||||
/* filecache.c, open filehandles cache */
|
/* filecache.c, open filehandles cache */
|
||||||
|
|
||||||
/* path.c, path parser */
|
/* path.c, path parser */
|
||||||
const char *parse_path PROTO3(char *, fullp, unsigned int, len, PPATH *, pp);
|
const char *parse_path (char * fullp, unsigned int len, PPATH * pp);
|
||||||
|
|
||||||
/* random.c, next key random degenerator */
|
/* random.c, next key random degenerator */
|
||||||
unsigned short gen_next_key PROTO0((void));
|
unsigned short gen_next_key (void);
|
||||||
|
|
||||||
/* iprange.c IP range services */
|
/* iprange.c IP range services */
|
||||||
extern IPrange *iptab;
|
extern IPrange *iptab;
|
||||||
const char *check_ip_table PROTO2(unsigned long, inet_num,IPrange *,table);
|
const char *check_ip_table (unsigned long inet_num,IPrange *table);
|
||||||
void free_ip_table PROTO1(IPrange *,table);
|
void free_ip_table (IPrange *table);
|
||||||
void add_ipline PROTO2(const char *, text, IPrange **, table);
|
void add_ipline (const char * text, IPrange ** table);
|
||||||
void dump_iptab PROTO2(IPrange *,table,FILE *, fp);
|
void dump_iptab (IPrange *table,FILE * fp);
|
||||||
|
|
||||||
/* host.c, DNS and IP host databases */
|
/* host.c, DNS and IP host databases */
|
||||||
HTAB *find_host PROTO0((unsigned long));
|
HTAB *find_host (unsigned long);
|
||||||
int init_htab PROTO0((void));
|
int init_htab (void);
|
||||||
int dump_htab PROTO1(FILE *,fn);
|
int dump_htab (FILE *fn);
|
||||||
|
|
||||||
/* server.c, network server operations */
|
/* server.c, network server operations */
|
||||||
extern time_t cur_time;
|
extern time_t cur_time;
|
||||||
extern int shutdowning;
|
extern int shutdowning;
|
||||||
RETSIGTYPE server_interrupt PROTO1(int, signum);
|
RETSIGTYPE server_interrupt (int signum);
|
||||||
RETSIGTYPE server_dump PROTO1(int, signum);
|
RETSIGTYPE server_dump (int signum);
|
||||||
int server_loop PROTO2(int,fd,time_t,timeout);
|
int server_loop (int fd,time_t timeout);
|
||||||
int server_reply PROTO0((struct sockaddr_in *, UBUF *, unsigned int, unsigned int));
|
int server_reply (struct sockaddr_in *, UBUF *, unsigned int, unsigned int);
|
||||||
void send_file PROTO0((struct sockaddr_in *, UBUF *, FILE *, unsigned int,
|
void send_file (struct sockaddr_in *, UBUF *, FILE *, unsigned int,
|
||||||
char *));
|
char *);
|
||||||
|
|
||||||
/* acl.c, security code */
|
/* acl.c, security code */
|
||||||
void load_access_rights PROTO1(DIRINFO *,di);
|
void load_access_rights (DIRINFO *di);
|
||||||
void save_access_rights PROTO1(DIRINFO *,di);
|
void save_access_rights (DIRINFO *di);
|
||||||
const char * require_access_rights PROTO4(const DIRINFO *,di,unsigned char,rights,unsigned long, ip_addr, const char *, passwd);
|
const char * require_access_rights (const DIRINFO *di,unsigned char rights,unsigned long ip_addr, const char * passwd);
|
||||||
|
|
||||||
/* main.c, startup and init code */
|
/* main.c, startup and init code */
|
||||||
|
|
||||||
/* log.c, log writter */
|
/* log.c, log writter */
|
||||||
extern int logfd;
|
extern int logfd;
|
||||||
extern int tlogfd;
|
extern int tlogfd;
|
||||||
void fsplogf PROTO0((void));
|
void fsplogf (void);
|
||||||
void fsplogs PROTO0((void));
|
void fsplogs (void);
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
void fsploga(const char *fmt, ...);
|
void fsploga(const char *fmt, ...);
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,4 @@
|
||||||
(V)[1] = ((A) ) & 0xff)
|
(V)[1] = ((A) ) & 0xff)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "proto.h"
|
|
||||||
|
|
||||||
#endif /* _FSP_TWEAK_H_ */
|
#endif /* _FSP_TWEAK_H_ */
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,4 @@ Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
*.o
|
*.o
|
||||||
fspd
|
fspd
|
||||||
cachecheck
|
|
||||||
.deps
|
.deps
|
||||||
|
|
|
||||||
14
server/acl.c
14
server/acl.c
|
|
@ -14,7 +14,7 @@
|
||||||
#include "my-string.h"
|
#include "my-string.h"
|
||||||
|
|
||||||
/* loads a password from file in current directory */
|
/* loads a password from file in current directory */
|
||||||
static char *load_password PROTO1(const char *, file)
|
static char *load_password (const char * file)
|
||||||
{
|
{
|
||||||
/* load password */
|
/* load password */
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
@ -34,7 +34,7 @@ static char *load_password PROTO1(const char *, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save a password to file in current directory */
|
/* save a password to file in current directory */
|
||||||
static void save_password PROTO2(const char *,file,const char *,password)
|
static void save_password (const char *file,const char *password)
|
||||||
{
|
{
|
||||||
/* load password */
|
/* load password */
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
@ -47,7 +47,7 @@ static void save_password PROTO2(const char *,file,const char *,password)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save access rights to filesystem */
|
/* save access rights to filesystem */
|
||||||
void save_access_rights PROTO1(DIRINFO *,di)
|
void save_access_rights (DIRINFO *di)
|
||||||
{
|
{
|
||||||
/* step 1 - unlink everything */
|
/* step 1 - unlink everything */
|
||||||
unlink(FSP_NOGET);
|
unlink(FSP_NOGET);
|
||||||
|
|
@ -90,7 +90,7 @@ void save_access_rights PROTO1(DIRINFO *,di)
|
||||||
|
|
||||||
/* called with current directory == tested directory */
|
/* called with current directory == tested directory */
|
||||||
/* load access rights for validated directory */
|
/* load access rights for validated directory */
|
||||||
void load_access_rights PROTO1(DIRINFO *,di)
|
void load_access_rights (DIRINFO *di)
|
||||||
{
|
{
|
||||||
struct stat sf;
|
struct stat sf;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
@ -113,7 +113,7 @@ void load_access_rights PROTO1(DIRINFO *,di)
|
||||||
* packetsize - pro_bytes (now 1) - 1 (for /0)
|
* packetsize - pro_bytes (now 1) - 1 (for /0)
|
||||||
*/
|
*/
|
||||||
s=min(packetsize-PRO_BYTES-1,sf.st_size);
|
s=min(packetsize-PRO_BYTES-1,sf.st_size);
|
||||||
di->readme=malloc(s+1);
|
di->readme=calloc(1,s+1); /* allocate also space for ending /0 */
|
||||||
if(di->readme)
|
if(di->readme)
|
||||||
{
|
{
|
||||||
fread(di->readme,s,1,f);
|
fread(di->readme,s,1,f);
|
||||||
|
|
@ -126,7 +126,7 @@ void load_access_rights PROTO1(DIRINFO *,di)
|
||||||
if(!use_access_files) return;
|
if(!use_access_files) return;
|
||||||
|
|
||||||
/* LOAD ACCESS RIGHTS FROM FILES IN CURRENT DIRECTORY */
|
/* LOAD ACCESS RIGHTS FROM FILES IN CURRENT DIRECTORY */
|
||||||
if(fexist(FSP_NOGET)) di->protection^=DIR_GET;
|
if(fexist(FSP_NOGET)) di->protection^=DIR_GET;
|
||||||
if(fexist(FSP_DEL)) di->protection|=DIR_DEL;
|
if(fexist(FSP_DEL)) di->protection|=DIR_DEL;
|
||||||
if(fexist(FSP_ADD)) di->protection|=DIR_ADD;
|
if(fexist(FSP_ADD)) di->protection|=DIR_ADD;
|
||||||
if(fexist(FSP_MKDIR)) di->protection|=DIR_MKDIR;
|
if(fexist(FSP_MKDIR)) di->protection|=DIR_MKDIR;
|
||||||
|
|
@ -159,7 +159,7 @@ void load_access_rights PROTO1(DIRINFO *,di)
|
||||||
* at least 'N' record to get it, if he has DIR_README, we will send him
|
* at least 'N' record to get it, if he has DIR_README, we will send him
|
||||||
* a datagram with error reply */
|
* a datagram with error reply */
|
||||||
|
|
||||||
const char * require_access_rights PROTO4(const DIRINFO *,di,unsigned char,rights,unsigned long, ip_addr, const char *, passwd)
|
const char * require_access_rights (const DIRINFO *di,unsigned char rights,unsigned long ip_addr, const char * passwd)
|
||||||
{
|
{
|
||||||
const char *acc=NULL;
|
const char *acc=NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,13 +75,13 @@ mode_t system_umask = 0077;
|
||||||
unsigned int fp_cache_limit=10;
|
unsigned int fp_cache_limit=10;
|
||||||
|
|
||||||
|
|
||||||
static void log_set PROTO2(int, flag, int, neg)
|
static void log_set (int flag, int neg)
|
||||||
{
|
{
|
||||||
if(neg) logging &= ~flag;
|
if(neg) logging &= ~flag;
|
||||||
else logging |= flag;
|
else logging |= flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_boolean PROTO1(const char, *q)
|
static int get_boolean (const char *q)
|
||||||
{
|
{
|
||||||
if(strcmp(q, "0") == 0) return 0;
|
if(strcmp(q, "0") == 0) return 0;
|
||||||
else
|
else
|
||||||
|
|
@ -101,7 +101,7 @@ static int get_boolean PROTO1(const char, *q)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_configuration PROTO1(const char *, name)
|
static void read_configuration (const char * name)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[1024], *p, *q;
|
char buf[1024], *p, *q;
|
||||||
|
|
@ -266,7 +266,7 @@ static void read_configuration PROTO1(const char *, name)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_configuration PROTO1(const char *,config_file)
|
void load_configuration (const char *config_file)
|
||||||
{
|
{
|
||||||
#ifdef LAMERPACK
|
#ifdef LAMERPACK
|
||||||
return;
|
return;
|
||||||
|
|
@ -284,7 +284,7 @@ void load_configuration PROTO1(const char *,config_file)
|
||||||
read_configuration(config_file);
|
read_configuration(config_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void destroy_configuration PROTO0((void))
|
void destroy_configuration (void)
|
||||||
{
|
{
|
||||||
if(readme_file) free(readme_file);
|
if(readme_file) free(readme_file);
|
||||||
if(home_dir) free(home_dir);
|
if(home_dir) free(home_dir);
|
||||||
|
|
|
||||||
207
server/file.c
207
server/file.c
|
|
@ -36,9 +36,9 @@ static struct FifoCache *fpcache;
|
||||||
#define FOURGIGS 0xffffffffUL
|
#define FOURGIGS 0xffffffffUL
|
||||||
#define TWOGIGS 0x7fffffffUL
|
#define TWOGIGS 0x7fffffffUL
|
||||||
|
|
||||||
static FPCACHE *search_fpcache PROTO3(unsigned long, inet_num,
|
static FPCACHE *search_fpcache (unsigned long inet_num,
|
||||||
unsigned short, port_num,
|
unsigned short port_num,
|
||||||
const char *, fname)
|
const char * fname)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
FPCACHE *entry;
|
FPCACHE *entry;
|
||||||
|
|
@ -63,7 +63,7 @@ static FPCACHE *search_fpcache PROTO3(unsigned long, inet_num,
|
||||||
return((FPCACHE *)0);
|
return((FPCACHE *)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fpcache_free_entry PROTO1(void *,entry)
|
static void fpcache_free_entry (void *entry)
|
||||||
{
|
{
|
||||||
FPCACHE *f=entry;
|
FPCACHE *f=entry;
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ static void fpcache_free_entry PROTO1(void *,entry)
|
||||||
fclose(f->fp);
|
fclose(f->fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int fpcache_entry_profiler PROTO1(void *,entry)
|
static unsigned int fpcache_entry_profiler (void *entry)
|
||||||
{
|
{
|
||||||
FPCACHE *f=entry;
|
FPCACHE *f=entry;
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@ static unsigned int fpcache_entry_profiler PROTO1(void *,entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void dirlistcache_free_entry PROTO1(void *, entry)
|
static void dirlistcache_free_entry (void * entry)
|
||||||
{
|
{
|
||||||
DIRLISTING *d=entry;
|
DIRLISTING *d=entry;
|
||||||
|
|
||||||
|
|
@ -90,14 +90,14 @@ static void dirlistcache_free_entry PROTO1(void *, entry)
|
||||||
free(d->listing);
|
free(d->listing);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int dirlistcache_entry_profiler PROTO1(void *,entry)
|
static unsigned int dirlistcache_entry_profiler (void *entry)
|
||||||
{
|
{
|
||||||
DIRLISTING *d=entry;
|
DIRLISTING *d=entry;
|
||||||
|
|
||||||
return d->listing_size;
|
return d->listing_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dirstatcache_free_entry PROTO1(void *, entry)
|
static void dirstatcache_free_entry (void * entry)
|
||||||
{
|
{
|
||||||
DIRINFO *d=entry;
|
DIRINFO *d=entry;
|
||||||
|
|
||||||
|
|
@ -113,8 +113,9 @@ static void dirstatcache_free_entry PROTO1(void *, entry)
|
||||||
free(d->readme);
|
free(d->readme);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int dirstatcache_entry_profiler PROTO1(void *,entry)
|
static unsigned int dirstatcache_entry_profiler (void *entry)
|
||||||
{
|
{
|
||||||
|
/* TODO profiling for owner ip_table */
|
||||||
DIRINFO *d=entry;
|
DIRINFO *d=entry;
|
||||||
unsigned int res=0;
|
unsigned int res=0;
|
||||||
if(d->realname)
|
if(d->realname)
|
||||||
|
|
@ -132,10 +133,6 @@ static unsigned int dirstatcache_entry_profiler PROTO1(void *,entry)
|
||||||
res+=strlen(d->public_password);
|
res+=strlen(d->public_password);
|
||||||
res++;
|
res++;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if(d->owner)
|
|
||||||
free_ip_table(d->owner);
|
|
||||||
*/
|
|
||||||
if(d->readme)
|
if(d->readme)
|
||||||
{
|
{
|
||||||
res+=strlen(d->readme);
|
res+=strlen(d->readme);
|
||||||
|
|
@ -145,14 +142,14 @@ static unsigned int dirstatcache_entry_profiler PROTO1(void *,entry)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void string_free PROTO1(void *, entry)
|
static void string_free (void * entry)
|
||||||
{
|
{
|
||||||
char **s=entry;
|
char **s=entry;
|
||||||
if(*s!=NULL)
|
if(*s!=NULL)
|
||||||
free(*s);
|
free(*s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int string_profiler PROTO1(void *,entry)
|
static unsigned int string_profiler (void *entry)
|
||||||
{
|
{
|
||||||
char **s=entry;
|
char **s=entry;
|
||||||
|
|
||||||
|
|
@ -162,7 +159,7 @@ static unsigned int string_profiler PROTO1(void *,entry)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int string_compare PROTO2(const void *,e1,const void *,e2)
|
static int string_compare (const void *e1,const void *e2)
|
||||||
{
|
{
|
||||||
|
|
||||||
char *const *s1=e1;
|
char *const *s1=e1;
|
||||||
|
|
@ -177,7 +174,7 @@ static int string_compare PROTO2(const void *,e1,const void *,e2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* should init all types of caches in future */
|
/* should init all types of caches in future */
|
||||||
int init_caches PROTO0((void))
|
int init_caches (void)
|
||||||
{
|
{
|
||||||
dirlistcache=f_cache_new(dir_cache_limit,sizeof(DIRLISTING),dirlistcache_free_entry,sizeof(char *),string_free,string_compare);
|
dirlistcache=f_cache_new(dir_cache_limit,sizeof(DIRLISTING),dirlistcache_free_entry,sizeof(char *),string_free,string_compare);
|
||||||
dirstatcache=f_cache_new(stat_cache_limit,sizeof(DIRINFO),dirstatcache_free_entry,sizeof(char *),string_free,string_compare);
|
dirstatcache=f_cache_new(stat_cache_limit,sizeof(DIRINFO),dirstatcache_free_entry,sizeof(char *),string_free,string_compare);
|
||||||
|
|
@ -199,7 +196,7 @@ int init_caches PROTO0((void))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stat_caches PROTO1(FILE *,fp)
|
void stat_caches (FILE *fp)
|
||||||
{
|
{
|
||||||
if(fp==NULL) fp=stderr;
|
if(fp==NULL) fp=stderr;
|
||||||
fprintf(fp,"DIRLISTCACHE ");
|
fprintf(fp,"DIRLISTCACHE ");
|
||||||
|
|
@ -211,7 +208,7 @@ void stat_caches PROTO1(FILE *,fp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* should init all types of caches in future */
|
/* should init all types of caches in future */
|
||||||
void shutdown_caches PROTO0((void))
|
void shutdown_caches (void)
|
||||||
{
|
{
|
||||||
#ifdef LAMERPACK
|
#ifdef LAMERPACK
|
||||||
fclose(stderr);
|
fclose(stderr);
|
||||||
|
|
@ -240,7 +237,7 @@ void shutdown_caches PROTO0((void))
|
||||||
* *di - where to return DIRINFO information about directory
|
* *di - where to return DIRINFO information about directory
|
||||||
* want_directory - want to operate on directory, not a file
|
* want_directory - want to operate on directory, not a file
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
const char *validate_path PROTO5(char *, fullp, unsigned, lenfullp, PPATH *, pp,DIRINFO **,di, int, want_directory)
|
const char *validate_path (char * fullp, unsigned lenfullp, PPATH * pp,DIRINFO **di, int want_directory)
|
||||||
{
|
{
|
||||||
char work [NBSIZE];
|
char work [NBSIZE];
|
||||||
const char *err;
|
const char *err;
|
||||||
|
|
@ -344,7 +341,7 @@ const char *validate_path PROTO5(char *, fullp, unsigned, lenfullp, PPATH *, pp,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy file : from -> to */
|
/* copy file : from -> to */
|
||||||
static const char *copy_file PROTO2(const char *, n1, const char *, n2)
|
static const char *copy_file (const char * n1, const char * n2)
|
||||||
{
|
{
|
||||||
FILE *ft,*fp;
|
FILE *ft,*fp;
|
||||||
size_t bytes;
|
size_t bytes;
|
||||||
|
|
@ -361,7 +358,19 @@ static const char *copy_file PROTO2(const char *, n1, const char *, n2)
|
||||||
}
|
}
|
||||||
/* copy temporary file to actual fput file */
|
/* copy temporary file to actual fput file */
|
||||||
while( (bytes = fread(buf,1,sizeof(buf),ft)))
|
while( (bytes = fread(buf,1,sizeof(buf),ft)))
|
||||||
fwrite(buf,1,bytes,fp);
|
{
|
||||||
|
if ( bytes != fwrite(buf,1,bytes,fp)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ferror(ft) || ferror(fp) )
|
||||||
|
{
|
||||||
|
fclose(ft);
|
||||||
|
fclose(fp);
|
||||||
|
unlink(n2);
|
||||||
|
return ("Write error");
|
||||||
|
}
|
||||||
|
|
||||||
fclose(ft);
|
fclose(ft);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
@ -369,7 +378,7 @@ static const char *copy_file PROTO2(const char *, n1, const char *, n2)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* appends new packet to directory listing, return 0 on success */
|
/* appends new packet to directory listing, return 0 on success */
|
||||||
static int append_dir_listing PROTO3(DIRLISTING *, dl,const char *, buf,unsigned int, size)
|
static int append_dir_listing (DIRLISTING * dl,const char * buf,unsigned int size)
|
||||||
{
|
{
|
||||||
BYTE *newbuf;
|
BYTE *newbuf;
|
||||||
|
|
||||||
|
|
@ -391,7 +400,7 @@ static int append_dir_listing PROTO3(DIRLISTING *, dl,const char *, buf,unsigned
|
||||||
/* builds directory listing into DIRLISTING structure, in case of any
|
/* builds directory listing into DIRLISTING structure, in case of any
|
||||||
* error. nulls dl->listing
|
* error. nulls dl->listing
|
||||||
*/
|
*/
|
||||||
static void build_dir_listing PROTO2(DIRLISTING *, dl,const char *,directory)
|
static void build_dir_listing (DIRLISTING * dl,const char *directory)
|
||||||
{
|
{
|
||||||
int skip; /* how many bytes skip to next 4byte boundary */
|
int skip; /* how many bytes skip to next 4byte boundary */
|
||||||
unsigned int rem; /* remaining free space in UDP data space */
|
unsigned int rem; /* remaining free space in UDP data space */
|
||||||
|
|
@ -486,7 +495,7 @@ static void build_dir_listing PROTO2(DIRLISTING *, dl,const char *,directory)
|
||||||
dl->mtime=cur_time;
|
dl->mtime=cur_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *server_get_dir PROTO2(DIRLISTING **, dl, const DIRINFO *, di)
|
const char *server_get_dir (DIRLISTING ** dl, const DIRINFO * di)
|
||||||
{
|
{
|
||||||
struct stat sf;
|
struct stat sf;
|
||||||
char list_p[NBSIZE];
|
char list_p[NBSIZE];
|
||||||
|
|
@ -578,7 +587,7 @@ const char *server_get_dir PROTO2(DIRLISTING **, dl, const DIRINFO *, di)
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/* assume path and ACL is validated */
|
/* assume path and ACL is validated */
|
||||||
const char *server_del_file PROTO2(PPATH *, pp, DIRINFO *, di)
|
const char *server_del_file (PPATH * pp, DIRINFO * di)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
|
|
@ -594,7 +603,7 @@ const char *server_del_file PROTO2(PPATH *, pp, DIRINFO *, di)
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
const char *server_del_dir PROTO2(PPATH *, pp, DIRINFO *,di)
|
const char *server_del_dir (PPATH * pp, DIRINFO *di)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
DIRINFO null;
|
DIRINFO null;
|
||||||
|
|
@ -623,7 +632,7 @@ const char *server_del_dir PROTO2(PPATH *, pp, DIRINFO *,di)
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
const char *server_make_dir PROTO3(PPATH *, pp, unsigned long, inet_num,DIRINFO, **di)
|
const char *server_make_dir (PPATH * pp, unsigned long inet_num,DIRINFO **di)
|
||||||
{
|
{
|
||||||
DIRINFO newdir;
|
DIRINFO newdir;
|
||||||
char temp_p[NBSIZE];
|
char temp_p[NBSIZE];
|
||||||
|
|
@ -658,11 +667,11 @@ const char *server_make_dir PROTO3(PPATH *, pp, unsigned long, inet_num,DIRINFO,
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
const char *server_get_file PROTO5(PPATH *, pp,
|
const char *server_get_file (PPATH * pp,
|
||||||
FILE **, fp,
|
FILE ** fp,
|
||||||
unsigned long, inet_num,
|
unsigned long inet_num,
|
||||||
unsigned short, port_num,
|
unsigned short port_num,
|
||||||
DIRINFO *, di
|
DIRINFO * di
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
@ -702,22 +711,29 @@ const char *server_get_file PROTO5(PPATH *, pp,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/* result and pp->fullp may overlap */
|
/* returns number of readme bytes
|
||||||
const char *server_get_pro PROTO3(DIRINFO *, di, char *, result, const char *, acc)
|
*/
|
||||||
|
int server_get_pro (DIRINFO * di, char * result, const char * acc)
|
||||||
{
|
{
|
||||||
result[0]='\0'; /* truncate output buffer */
|
int pos=0;
|
||||||
|
|
||||||
if(di->readme) strcat(result,di->readme);
|
if(di->readme)
|
||||||
result[strlen(result)+1] = di->protection^DIR_GET;
|
{
|
||||||
|
strcpy(result,di->readme);
|
||||||
|
pos=strlen(result); /* add readme */
|
||||||
|
pos++; /* add zero terminator char */
|
||||||
|
}
|
||||||
|
/* append xtra data space area */
|
||||||
|
result[pos] = di->protection^DIR_GET;
|
||||||
if(acc[0]=='O')
|
if(acc[0]=='O')
|
||||||
result[strlen(result)+1] |= DIR_OWNER;
|
result[pos] |= DIR_OWNER;
|
||||||
|
|
||||||
return(NULLP);
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
const char *server_set_pro PROTO2(DIRINFO *,di, const char *, key)
|
const char *server_set_pro (DIRINFO *di, const char * key)
|
||||||
{
|
{
|
||||||
unsigned char act;
|
unsigned char act;
|
||||||
|
|
||||||
|
|
@ -768,8 +784,8 @@ const char *server_set_pro PROTO2(DIRINFO *,di, const char *, key)
|
||||||
* These two are used for file uploading.
|
* These two are used for file uploading.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
const char *server_up_load PROTO5(char *, data, unsigned int, len, unsigned long, pos,
|
const char *server_up_load (char * data, unsigned int len, unsigned long pos,
|
||||||
unsigned long, inet_num, unsigned short, port_num)
|
unsigned long inet_num, unsigned short port_num)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char tname[NBSIZE];
|
char tname[NBSIZE];
|
||||||
|
|
@ -856,8 +872,8 @@ const char *server_up_load PROTO5(char *, data, unsigned int, len, unsigned long
|
||||||
return(NULLP);
|
return(NULLP);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *server_install PROTO7(PPATH *, pp, unsigned long, inet_num,
|
const char *server_install (PPATH * pp, unsigned long inet_num,
|
||||||
unsigned short, port_num, const char *, acc, DIRINFO *,di, unsigned int, l2, const char *,s2)
|
unsigned short port_num, const char * acc, DIRINFO *di, unsigned int l2, const char *s2)
|
||||||
{
|
{
|
||||||
char tname[NBSIZE];
|
char tname[NBSIZE];
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
|
|
@ -911,8 +927,8 @@ const char *server_install PROTO7(PPATH *, pp, unsigned long, inet_num,
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/* assume path is validated */
|
/* assume path is validated */
|
||||||
/* start GRAB OPERATION! */
|
/* start GRAB OPERATION! */
|
||||||
const char *server_secure_file PROTO4(PPATH *, pp, unsigned long, inet_num,
|
const char *server_secure_file (PPATH * pp, unsigned long inet_num,
|
||||||
unsigned short, port_num,DIRINFO *,di)
|
unsigned short port_num,DIRINFO *di)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
char temp_p[NBSIZE];
|
char temp_p[NBSIZE];
|
||||||
|
|
@ -939,9 +955,9 @@ const char *server_secure_file PROTO4(PPATH *, pp, unsigned long, inet_num,
|
||||||
return(NULLP);
|
return(NULLP);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *server_grab_file PROTO3(FILE **, fp,
|
const char *server_grab_file (FILE ** fp,
|
||||||
unsigned long, inet_num,
|
unsigned long inet_num,
|
||||||
unsigned short, port_num)
|
unsigned short port_num)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
char temp_p[NBSIZE];
|
char temp_p[NBSIZE];
|
||||||
|
|
@ -969,8 +985,8 @@ const char *server_grab_file PROTO3(FILE **, fp,
|
||||||
return(NULLP);
|
return(NULLP);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *server_grab_done PROTO2(unsigned long, inet_num,
|
const char *server_grab_done (unsigned long inet_num,
|
||||||
unsigned short, port_num)
|
unsigned short port_num)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
char temp_p[NBSIZE];
|
char temp_p[NBSIZE];
|
||||||
|
|
@ -987,7 +1003,7 @@ const char *server_grab_done PROTO2(unsigned long, inet_num,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return STAT info about filesystem object */
|
/* return STAT info about filesystem object */
|
||||||
const char *server_stat PROTO1(UBUF *, ubuf )
|
const char *server_stat (UBUF * ubuf )
|
||||||
{
|
{
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
@ -1041,33 +1057,92 @@ const char *server_stat PROTO1(UBUF *, ubuf )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rename FILE/directory object */
|
/* rename FILE/directory object */
|
||||||
const char *server_rename PROTO3(char *, ub, unsigned int, l1, unsigned int, l2)
|
const char *server_rename (char * ub, unsigned int l1, unsigned long inet)
|
||||||
{
|
{
|
||||||
return "Not implemented (wait for next beta)";
|
|
||||||
#if 0
|
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
int srcdir; /* is source object a directory ? */
|
int issrcdir, istargetdir;
|
||||||
PPATH dest;
|
unsigned n;
|
||||||
|
PPATH src,dest;
|
||||||
const char *pe;
|
const char *pe;
|
||||||
|
DIRINFO *sdir,*tdir;
|
||||||
|
|
||||||
if(FSP_STAT(pp->fullp,&sb)) return("can't find source file or directory");
|
/* compute size of 1st component */
|
||||||
|
for(n=0;n<l1;n++)
|
||||||
|
if(ub[n] == '\0')
|
||||||
|
break;
|
||||||
|
n++;
|
||||||
|
|
||||||
|
/* parse suplied request data */
|
||||||
|
pe=parse_path(ub, n, &src );
|
||||||
|
if(pe)
|
||||||
|
return pe;
|
||||||
|
|
||||||
|
pe=parse_path(ub+n,l1- n, &dest );
|
||||||
|
if(pe)
|
||||||
|
return pe;
|
||||||
|
|
||||||
|
/* explore type of source object */
|
||||||
|
if(FSP_STAT(src.fullp,&sb)) return("can't find source file or directory");
|
||||||
if(S_ISDIR(sb.st_mode))
|
if(S_ISDIR(sb.st_mode))
|
||||||
srcdir=1;
|
issrcdir=1;
|
||||||
else
|
else
|
||||||
if(S_ISREG(sb.st_mode))
|
if(S_ISREG(sb.st_mode))
|
||||||
srcdir=0;
|
issrcdir=0;
|
||||||
else
|
else
|
||||||
return ("Will not rename non file/directory objects");
|
return ("Refusing to operate on special files");
|
||||||
|
/* validate source object */
|
||||||
|
pe=validate_path(ub,n,&src,&sdir,0);
|
||||||
|
if(pe) return pe;
|
||||||
|
|
||||||
pe=parse_path(ub+strlen(fullp), l1, &dest );
|
/* --- explore Target --- */
|
||||||
return(NULLP);
|
if(FSP_STAT(dest.fullp,&sb))
|
||||||
#endif
|
istargetdir=-1; /* non - existent! */
|
||||||
|
else
|
||||||
|
if(S_ISDIR(sb.st_mode))
|
||||||
|
istargetdir=1;
|
||||||
|
else
|
||||||
|
if(S_ISREG(sb.st_mode))
|
||||||
|
istargetdir=0;
|
||||||
|
else
|
||||||
|
return ("Refusing to operate on special files");
|
||||||
|
|
||||||
|
/* validate target */
|
||||||
|
if(istargetdir==1)
|
||||||
|
pe=validate_path(ub+n,l1 - n,&dest,&tdir,1);
|
||||||
|
else
|
||||||
|
pe=validate_path(ub+n,l1 - n,&dest,&tdir,0);
|
||||||
|
if(pe) return pe;
|
||||||
|
|
||||||
|
/* --=== now check ACL and do it ===-- */
|
||||||
|
|
||||||
|
/* Cross - directory rename? */
|
||||||
|
if (sdir == tdir)
|
||||||
|
{
|
||||||
|
/* no, do simple rename */
|
||||||
|
|
||||||
|
pe=require_access_rights( sdir,DIR_RENAME,inet,src.passwd);
|
||||||
|
if(pe[0]!='N')
|
||||||
|
return ("Permission denied");
|
||||||
|
if(istargetdir==0)
|
||||||
|
pe=require_access_rights( sdir,DIR_DEL,inet,src.passwd);
|
||||||
|
if(pe[0]!='N')
|
||||||
|
return ("No permission for overwriting files");
|
||||||
|
/* now go to the action */
|
||||||
|
if (rename(src.fullp,dest.fullp))
|
||||||
|
return ("Rename failed");
|
||||||
|
/* update dir listing */
|
||||||
|
sdir->lastcheck=cur_time;
|
||||||
|
sdir->mtime=cur_time;
|
||||||
|
return NULLP;
|
||||||
|
}
|
||||||
|
return ("Cross-directory renames are not implemented yet.");
|
||||||
|
/* return(NULLP); */
|
||||||
}
|
}
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
test and resolve home directory
|
test and resolve home directory
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
void init_home_dir PROTO0((void))
|
void init_home_dir (void)
|
||||||
{
|
{
|
||||||
void *newhd;
|
void *newhd;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ static HTAB hzero;
|
||||||
* Look up the hostname for an inet number. Return NULL if not found.
|
* Look up the hostname for an inet number. Return NULL if not found.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static char *find_hostname PROTO1(unsigned long, inet_num)
|
static char *find_hostname (unsigned long inet_num)
|
||||||
{
|
{
|
||||||
struct hostent *he;
|
struct hostent *he;
|
||||||
char *hostname;
|
char *hostname;
|
||||||
|
|
@ -53,7 +53,7 @@ static char *find_hostname PROTO1(unsigned long, inet_num)
|
||||||
* Entries are searched using binary search on the array.
|
* Entries are searched using binary search on the array.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
HTAB *find_host PROTO1(unsigned long, inet_num)
|
HTAB *find_host (unsigned long inet_num)
|
||||||
{
|
{
|
||||||
unsigned l, h, m, i;
|
unsigned l, h, m, i;
|
||||||
unsigned long inum;
|
unsigned long inum;
|
||||||
|
|
@ -97,7 +97,7 @@ HTAB *find_host PROTO1(unsigned long, inet_num)
|
||||||
* Client database initialization routine.
|
* Client database initialization routine.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int init_htab PROTO0((void)) /* always have 2 entries -- 0, MAXINT */
|
int init_htab (void) /* always have 2 entries -- 0, MAXINT */
|
||||||
{
|
{
|
||||||
if(!(htab = (HTAB *) malloc(sizeof(HTAB)*HALLOC_SIZE))) {
|
if(!(htab = (HTAB *) malloc(sizeof(HTAB)*HALLOC_SIZE))) {
|
||||||
perror("grow_htab malloc");
|
perror("grow_htab malloc");
|
||||||
|
|
@ -115,7 +115,7 @@ int init_htab PROTO0((void)) /* always have 2 entries -- 0, MAXINT */
|
||||||
* Write out the client table in the .HTAB_DUMP file.
|
* Write out the client table in the .HTAB_DUMP file.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int dump_htab PROTO1(FILE *,fp)
|
int dump_htab (FILE *fp)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
HTAB *hp;
|
HTAB *hp;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ IPrange *iptab=NULL;
|
||||||
/* check if inet_number matches entry in IPrange table */
|
/* check if inet_number matches entry in IPrange table */
|
||||||
/* return pointer to specified message */
|
/* return pointer to specified message */
|
||||||
|
|
||||||
static char *check_ip PROTO2(unsigned long, inet_num, const IPrange *, iprange)
|
static char *check_ip (unsigned long inet_num, const IPrange * iprange)
|
||||||
{
|
{
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
unsigned char val[4];
|
unsigned char val[4];
|
||||||
|
|
@ -43,7 +43,7 @@ static char *check_ip PROTO2(unsigned long, inet_num, const IPrange *, iprange)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *check_ip_table PROTO2(unsigned long, inet_num,IPrange *,table)
|
const char *check_ip_table (unsigned long inet_num,IPrange *table)
|
||||||
{
|
{
|
||||||
char *res;
|
char *res;
|
||||||
|
|
||||||
|
|
@ -57,7 +57,7 @@ const char *check_ip_table PROTO2(unsigned long, inet_num,IPrange *,table)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_ip_table PROTO1(IPrange *,table)
|
void free_ip_table (IPrange *table)
|
||||||
{
|
{
|
||||||
IPrange *head=table;
|
IPrange *head=table;
|
||||||
/* free strings */
|
/* free strings */
|
||||||
|
|
@ -74,7 +74,7 @@ void free_ip_table PROTO1(IPrange *,table)
|
||||||
if there is any error in forming the value (e.g., the text string
|
if there is any error in forming the value (e.g., the text string
|
||||||
isn't an integer, or the integer value is too large) then make the
|
isn't an integer, or the integer value is too large) then make the
|
||||||
text string NULL */
|
text string NULL */
|
||||||
static unsigned char parse_ipcomponentnum PROTO1(const char * *, textp)
|
static unsigned char parse_ipcomponentnum (const char * * textp)
|
||||||
{
|
{
|
||||||
unsigned long val = 0;
|
unsigned long val = 0;
|
||||||
|
|
||||||
|
|
@ -99,8 +99,8 @@ static unsigned char parse_ipcomponentnum PROTO1(const char * *, textp)
|
||||||
integer '-' integer >> range of values
|
integer '-' integer >> range of values
|
||||||
'*' >> same as 0-255
|
'*' >> same as 0-255
|
||||||
*/
|
*/
|
||||||
static const char *parse_ipcomponent PROTO3(const char *, text, unsigned char *, lo,
|
static const char *parse_ipcomponent (const char * text, unsigned char * lo,
|
||||||
unsigned char *, hi)
|
unsigned char * hi)
|
||||||
{
|
{
|
||||||
if (*text == '*') {
|
if (*text == '*') {
|
||||||
*lo = 0x00;
|
*lo = 0x00;
|
||||||
|
|
@ -119,7 +119,7 @@ static const char *parse_ipcomponent PROTO3(const char *, text, unsigned char *,
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IPrange *parse_ipnumber PROTO1(const char *, text)
|
static IPrange *parse_ipnumber (const char * text)
|
||||||
{
|
{
|
||||||
IPrange *reply;
|
IPrange *reply;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -148,7 +148,7 @@ static IPrange *parse_ipnumber PROTO1(const char *, text)
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IPrange *parse_hostname PROTO2(const char *, text, unsigned int, len)
|
static IPrange *parse_hostname (const char * text, unsigned int len)
|
||||||
{
|
{
|
||||||
IPrange *reply;
|
IPrange *reply;
|
||||||
struct hostent *hostaddr;
|
struct hostent *hostaddr;
|
||||||
|
|
@ -186,7 +186,7 @@ static IPrange *parse_hostname PROTO2(const char *, text, unsigned int, len)
|
||||||
# 128.4-8.*.* -- (* acts as the range 0 - 255)
|
# 128.4-8.*.* -- (* acts as the range 0 - 255)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static IPrange *parse_ipline PROTO1(const char *, text)
|
static IPrange *parse_ipline (const char * text)
|
||||||
{
|
{
|
||||||
IPrange *reply;
|
IPrange *reply;
|
||||||
char type = 0;
|
char type = 0;
|
||||||
|
|
@ -253,7 +253,7 @@ static IPrange *parse_ipline PROTO1(const char *, text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void add_ipline PROTO2(const char *, text, IPrange **, table)
|
void add_ipline (const char * text, IPrange ** table)
|
||||||
{
|
{
|
||||||
IPrange *nl;
|
IPrange *nl;
|
||||||
IPrange *newtab;
|
IPrange *newtab;
|
||||||
|
|
@ -285,7 +285,7 @@ void add_ipline PROTO2(const char *, text, IPrange **, table)
|
||||||
* Write out the IP table in the .IPTAB_DUMP file.
|
* Write out the IP table in the .IPTAB_DUMP file.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void dump_iptab PROTO2(IPrange *,table,FILE *, fp)
|
void dump_iptab (IPrange *table,FILE * fp)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(fp==NULL)
|
if(fp==NULL)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ void fsploga(const char *fmt, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add a datestamp to begining of the log message, clear text in buffer */
|
/* add a datestamp to begining of the log message, clear text in buffer */
|
||||||
void fsplogs PROTO0((void))
|
void fsplogs (void)
|
||||||
{
|
{
|
||||||
|
|
||||||
int timelen;
|
int timelen;
|
||||||
|
|
@ -54,7 +54,7 @@ void fsplogs PROTO0((void))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flush logfile */
|
/* flush logfile */
|
||||||
void fsplogf PROTO0((void))
|
void fsplogf (void)
|
||||||
{
|
{
|
||||||
if(dbug) {
|
if(dbug) {
|
||||||
fwrite("[LOG] ",6,1,stdout);
|
fwrite("[LOG] ",6,1,stdout);
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
static int inetd_mode = 0;
|
static int inetd_mode = 0;
|
||||||
static const char *config_file = CONF_FILE ;
|
static const char *config_file = CONF_FILE ;
|
||||||
|
|
||||||
static void display_version PROTO0((void))
|
static void display_version (void)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
#ifndef LAMERPACK
|
#ifndef LAMERPACK
|
||||||
|
|
@ -40,12 +40,12 @@ static void display_version PROTO0((void))
|
||||||
|
|
||||||
/* flush the log message to file */
|
/* flush the log message to file */
|
||||||
|
|
||||||
static void arg_err PROTO0((void))
|
static void arg_err (void)
|
||||||
{
|
{
|
||||||
fputs("Usage: fspd [-f configfile] [-d directory] [-v|-V] [-i] [-F] [-p port] [-X] [-t timeout] [-T temporary directory] [-l logfile] [-P pidlogname] [-b bytes/sec]\n", stderr);
|
fputs("Usage: fspd [-f configfile] [-d directory] [-v|-V] [-i] [-F] [-p port] [-X] [-t timeout] [-T temporary directory] [-l logfile] [-P pidlogname] [-b bytes/sec]\n", stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_required_vars PROTO0((void))
|
static void check_required_vars (void)
|
||||||
{
|
{
|
||||||
double rnd;
|
double rnd;
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ static void check_required_vars PROTO0((void))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_random PROTO0((void))
|
static void init_random (void)
|
||||||
{
|
{
|
||||||
unsigned int seed;
|
unsigned int seed;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
@ -126,7 +126,7 @@ static void init_random PROTO0((void))
|
||||||
srandom(seed);
|
srandom(seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main PROTO2(int, argc, char **, argv)
|
int main (int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
long inetd_timeout=0;
|
long inetd_timeout=0;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
* d_ptr is generally not null-terminated.
|
* d_ptr is generally not null-terminated.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
const char *parse_path PROTO3(char *, fullp, unsigned int, len, PPATH *, pp)
|
const char *parse_path (char * fullp, unsigned int len, PPATH * pp)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* get high bits from random result - better */
|
/* get high bits from random result - better */
|
||||||
unsigned short gen_next_key PROTO0((void))
|
unsigned short gen_next_key (void)
|
||||||
{
|
{
|
||||||
return (random() >> 15);
|
return (random() >> 15);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
101
server/server.c
101
server/server.c
|
|
@ -28,8 +28,8 @@ static int thc[THCCOUNT];
|
||||||
static time_t thcbase;
|
static time_t thcbase;
|
||||||
static int myfd;
|
static int myfd;
|
||||||
|
|
||||||
static void server_process_packet PROTO0((unsigned, UBUF *, int, HTAB *,
|
static void server_process_packet (unsigned, UBUF *, int, HTAB *,
|
||||||
struct sockaddr_in *));
|
struct sockaddr_in *);
|
||||||
|
|
||||||
/* log 1 argument */
|
/* log 1 argument */
|
||||||
#define ACTIONLOG0(FLAG,X) \
|
#define ACTIONLOG0(FLAG,X) \
|
||||||
|
|
@ -81,12 +81,12 @@ do { if((logging & (FLAG)) && !old) { \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
RETSIGTYPE server_interrupt PROTO1(int, signum)
|
RETSIGTYPE server_interrupt (int signum)
|
||||||
{
|
{
|
||||||
shutdowning = 1;
|
shutdowning = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETSIGTYPE server_dump PROTO1(int, signum)
|
RETSIGTYPE server_dump (int signum)
|
||||||
{
|
{
|
||||||
dump = 1;
|
dump = 1;
|
||||||
#ifndef RELIABLE_SIGNALS
|
#ifndef RELIABLE_SIGNALS
|
||||||
|
|
@ -139,7 +139,7 @@ static const char * print_command(unsigned char cmd)
|
||||||
* Send an error string to client.
|
* Send an error string to client.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void send_error PROTO3(struct sockaddr_in *, from, UBUF *, ub, const char *, msg)
|
static void send_error (struct sockaddr_in * from, UBUF * ub, const char * msg)
|
||||||
{
|
{
|
||||||
size_t sz;
|
size_t sz;
|
||||||
|
|
||||||
|
|
@ -157,7 +157,7 @@ static void send_error PROTO3(struct sockaddr_in *, from, UBUF *, ub, const char
|
||||||
* Those message that passed get sent to the dispatch loop.
|
* Those message that passed get sent to the dispatch loop.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int server_loop PROTO2(int, fd, time_t, timeout)
|
int server_loop (int fd, time_t timeout)
|
||||||
{
|
{
|
||||||
HTAB *hp;
|
HTAB *hp;
|
||||||
const char *ir;
|
const char *ir;
|
||||||
|
|
@ -302,8 +302,8 @@ int server_loop PROTO2(int, fd, time_t, timeout)
|
||||||
* len1, len2: lengths of the two data regions in the message buffer.
|
* len1, len2: lengths of the two data regions in the message buffer.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int server_reply PROTO4(struct sockaddr_in *, from, UBUF *, ub,
|
int server_reply (struct sockaddr_in *from, UBUF * ub,
|
||||||
unsigned int, len1,unsigned int, len2)
|
unsigned int len1,unsigned int len2)
|
||||||
{
|
{
|
||||||
unsigned char *s, *t, *d;
|
unsigned char *s, *t, *d;
|
||||||
unsigned sum;
|
unsigned sum;
|
||||||
|
|
@ -374,8 +374,8 @@ return(0);
|
||||||
* message buffer.
|
* message buffer.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void send_file PROTO5(struct sockaddr_in *, from, UBUF *, ub, FILE *, fp,
|
void send_file (struct sockaddr_in * from, UBUF * ub, FILE * fp,
|
||||||
unsigned int, has_len, char *, lp)
|
unsigned int has_len, char * lp)
|
||||||
{
|
{
|
||||||
size_t bytes;
|
size_t bytes;
|
||||||
unsigned len;
|
unsigned len;
|
||||||
|
|
@ -413,15 +413,12 @@ void send_file PROTO5(struct sockaddr_in *, from, UBUF *, ub, FILE *, fp,
|
||||||
* Note: no bounds checking is currently performed. As version information
|
* Note: no bounds checking is currently performed. As version information
|
||||||
* grows, this will become required.
|
* grows, this will become required.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static void server_show_version PROTO2(struct sockaddr_in *, from, UBUF *, ub)
|
#ifndef LAMERPACK
|
||||||
|
static void server_show_version (struct sockaddr_in * from, UBUF * ub)
|
||||||
{
|
{
|
||||||
char buf[UBUF_SPACE], verflags = 0;
|
char buf[UBUF_SPACE], verflags = 0;
|
||||||
unsigned int xtra = VER_BYTES;
|
unsigned int xtra = VER_BYTES;
|
||||||
#ifndef LAMERPACK
|
|
||||||
strcpy(buf, "fspd " PACKAGE_VERSION);
|
strcpy(buf, "fspd " PACKAGE_VERSION);
|
||||||
#else
|
|
||||||
strcpy(buf, "fsp server " PACKAGE_VERSION" for lamerz");
|
|
||||||
#endif
|
|
||||||
strcat(buf, "\n");
|
strcat(buf, "\n");
|
||||||
|
|
||||||
if (logging) verflags |= VER_LOG;
|
if (logging) verflags |= VER_LOG;
|
||||||
|
|
@ -430,6 +427,11 @@ static void server_show_version PROTO2(struct sockaddr_in *, from, UBUF *, ub)
|
||||||
if (priv_mode) verflags |= VER_PRIVMODE;
|
if (priv_mode) verflags |= VER_PRIVMODE;
|
||||||
if (maxthcallowed) verflags |= VER_THRUPUT;
|
if (maxthcallowed) verflags |= VER_THRUPUT;
|
||||||
|
|
||||||
|
/* we are accepting xtra data on input */
|
||||||
|
/* because UDP tranport provides data size */
|
||||||
|
|
||||||
|
verflags |= VER_XTRADATA;
|
||||||
|
|
||||||
strcpy(ub->buf, buf);
|
strcpy(ub->buf, buf);
|
||||||
ub->buf[strlen(ub->buf)] = '\0';
|
ub->buf[strlen(ub->buf)] = '\0';
|
||||||
ub->buf[strlen(ub->buf)+1] = verflags;
|
ub->buf[strlen(ub->buf)+1] = verflags;
|
||||||
|
|
@ -444,7 +446,7 @@ static void server_show_version PROTO2(struct sockaddr_in *, from, UBUF *, ub)
|
||||||
BB_WRITE4(ub->bb_pos,xtra);
|
BB_WRITE4(ub->bb_pos,xtra);
|
||||||
server_reply(from, ub, strlen(ub->buf)+1, xtra);
|
server_reply(from, ub, strlen(ub->buf)+1, xtra);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* This is the dispatch loop for message that has been accepted.
|
* This is the dispatch loop for message that has been accepted.
|
||||||
* Serves command in message and sends out a reply.
|
* Serves command in message and sends out a reply.
|
||||||
|
|
@ -455,8 +457,8 @@ static void server_show_version PROTO2(struct sockaddr_in *, from, UBUF *, ub)
|
||||||
* from: pointer to the socket address structure of the client host.
|
* from: pointer to the socket address structure of the client host.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static void server_process_packet PROTO5(unsigned, bytes, UBUF *, ub, int, old,
|
static void server_process_packet (unsigned bytes, UBUF * ub, int old,
|
||||||
HTAB *, hp, struct sockaddr_in *, from)
|
HTAB * hp, struct sockaddr_in * from)
|
||||||
{
|
{
|
||||||
unsigned long inet_num, pos;
|
unsigned long inet_num, pos;
|
||||||
unsigned short port_num;
|
unsigned short port_num;
|
||||||
|
|
@ -503,10 +505,16 @@ static void server_process_packet PROTO5(unsigned, bytes, UBUF *, ub, int, old,
|
||||||
|
|
||||||
switch(ub->cmd) {
|
switch(ub->cmd) {
|
||||||
case CC_VERSION:
|
case CC_VERSION:
|
||||||
if(! ver_enabled) return;
|
#ifdef LAMERPACK
|
||||||
|
ACTIONLOG0(L_VER,"AVOIDED SCAN DETECTION");
|
||||||
|
ACTIONOK(L_VER);
|
||||||
|
#else
|
||||||
|
if(! ver_enabled)
|
||||||
|
return;
|
||||||
ACTIONLOG0(L_VER,"VERSION");
|
ACTIONLOG0(L_VER,"VERSION");
|
||||||
server_show_version(from, ub);
|
server_show_version(from, ub);
|
||||||
ACTIONOK(L_VER);
|
ACTIONOK(L_VER);
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
case CC_BYE:
|
case CC_BYE:
|
||||||
hp->active = 0; /* was: if(!old) before, why? */
|
hp->active = 0; /* was: if(!old) before, why? */
|
||||||
|
|
@ -723,16 +731,9 @@ static void server_process_packet PROTO5(unsigned, bytes, UBUF *, ub, int, old,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CHECK_ACCESS_RIGHTS(0,L_MAKEDIR);
|
CHECK_ACCESS_RIGHTS(0,L_MAKEDIR);
|
||||||
pe = server_get_pro(di,ub->buf,pe);
|
l1 = server_get_pro(di,ub->buf,pe);
|
||||||
if(pe)
|
|
||||||
{
|
|
||||||
ACTIONLOG1(L_MAKEDIR|L_ERR,"GETPRO");
|
|
||||||
ACTIONFAILED(L_MAKEDIR|L_ERR,pe);
|
|
||||||
send_error(from, ub, pe) ;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BB_WRITE4(ub->bb_pos,PRO_BYTES);
|
BB_WRITE4(ub->bb_pos,PRO_BYTES);
|
||||||
server_reply(from,ub,strlen(ub->buf)+1,PRO_BYTES);
|
server_reply(from,ub,l1,PRO_BYTES);
|
||||||
ACTIONOK(L_MAKEDIR);
|
ACTIONOK(L_MAKEDIR);
|
||||||
return;
|
return;
|
||||||
case CC_GET_PRO :
|
case CC_GET_PRO :
|
||||||
|
|
@ -746,16 +747,9 @@ static void server_process_packet PROTO5(unsigned, bytes, UBUF *, ub, int, old,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CHECK_ACCESS_RIGHTS(0,L_GETPRO);
|
CHECK_ACCESS_RIGHTS(0,L_GETPRO);
|
||||||
pe=server_get_pro(di,ub->buf,pe);
|
l1=server_get_pro(di,ub->buf,pe);
|
||||||
if(pe)
|
|
||||||
{
|
|
||||||
ACTIONLOG1(L_GETPRO|L_ERR,"GETPRO");
|
|
||||||
ACTIONFAILED(L_GETPRO|L_ERR,pe);
|
|
||||||
send_error(from, ub, pe) ;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BB_WRITE4(ub->bb_pos,PRO_BYTES);
|
BB_WRITE4(ub->bb_pos,PRO_BYTES);
|
||||||
server_reply(from,ub,strlen(ub->buf)+1,PRO_BYTES);
|
server_reply(from,ub,l1,PRO_BYTES);
|
||||||
ACTIONOK(L_GETPRO);
|
ACTIONOK(L_GETPRO);
|
||||||
return;
|
return;
|
||||||
case CC_SET_PRO :
|
case CC_SET_PRO :
|
||||||
|
|
@ -786,16 +780,9 @@ static void server_process_packet PROTO5(unsigned, bytes, UBUF *, ub, int, old,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pe = server_get_pro(di,ub->buf,"O");
|
l1 = server_get_pro(di,ub->buf,"O");
|
||||||
if( pe )
|
|
||||||
{
|
|
||||||
ACTIONLOG1(L_SETPRO|L_ERR,"SETPRO");
|
|
||||||
ACTIONFAILED(L_SETPRO|L_ERR,pe);
|
|
||||||
send_error(from, ub, pe) ;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BB_WRITE4(ub->bb_pos,PRO_BYTES);
|
BB_WRITE4(ub->bb_pos,PRO_BYTES);
|
||||||
server_reply(from,ub,strlen(ub->buf)+1,PRO_BYTES);
|
server_reply(from,ub,l1,PRO_BYTES);
|
||||||
ACTIONOK(L_SETPRO);
|
ACTIONOK(L_SETPRO);
|
||||||
return;
|
return;
|
||||||
case CC_GRAB_FILE:
|
case CC_GRAB_FILE:
|
||||||
|
|
@ -878,14 +865,22 @@ static void server_process_packet PROTO5(unsigned, bytes, UBUF *, ub, int, old,
|
||||||
ACTIONOK(L_STAT);
|
ACTIONOK(L_STAT);
|
||||||
return;
|
return;
|
||||||
case CC_RENAME :
|
case CC_RENAME :
|
||||||
ACTIONLOG2(L_RENAME,"RENAME");
|
if (read_only) {
|
||||||
/* CHECK_ACCESS_RIGHTS(DIR_RENAME,L_RENAME); */
|
ACTIONLOG1(L_RDONLY,"RENAME");
|
||||||
if ( (pe = server_rename(ub->buf,l1,l2)) )
|
ACTIONFAILED(L_RDONLY,"Server is running in read-only mode");
|
||||||
|
send_error(from, ub, "Server is running in read-only mode");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!old)
|
||||||
{
|
{
|
||||||
ACTIONLOG1(L_RENAME|L_ERR,"RENAME");
|
ACTIONLOG2(L_RENAME,"RENAME");
|
||||||
ACTIONFAILED(L_RENAME|L_ERR,pe);
|
if ( (pe = server_rename(ub->buf,l1,inet_num)) )
|
||||||
send_error(from, ub, pe);
|
{
|
||||||
return;
|
ACTIONLOG1(L_RENAME|L_ERR,"RENAME");
|
||||||
|
ACTIONFAILED(L_RENAME|L_ERR,pe);
|
||||||
|
send_error(from, ub, pe);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
server_reply(from,ub,0,0);
|
server_reply(from,ub,0,0);
|
||||||
ACTIONOK(L_RENAME);
|
ACTIONOK(L_RENAME);
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ int dbug=1;
|
||||||
|
|
||||||
const char *testcases[]={
|
const char *testcases[]={
|
||||||
"", ".","/",
|
"", ".","/",
|
||||||
|
"\nonlypwd",
|
||||||
"filename","/filename","//filename",
|
"filename","/filename","//filename",
|
||||||
"dirname/filename","//dirname/filename","//dirname//filename",
|
"dirname/filename","//dirname/filename","//dirname//filename",
|
||||||
"dir1name/dir2name/","//dir1name//dir2name//",
|
"dir1name/dir2name/","//dir1name//dir2name//",
|
||||||
|
|
@ -21,6 +22,7 @@ const char *testcases[]={
|
||||||
NULL};
|
NULL};
|
||||||
PPATH testresults[]={
|
PPATH testresults[]={
|
||||||
{".",".",1,".",1,NULL}, {NULL}, {".",".",1,".",1,NULL},
|
{".",".",1,".",1,NULL}, {NULL}, {".",".",1,".",1,NULL},
|
||||||
|
{".",".",1,".",1,"onlypwd"},
|
||||||
{"filename","filename",8,".",1,NULL} , {"filename","filename",8,".",1,NULL} , {"filename","filename",8,".",1,NULL},
|
{"filename","filename",8,".",1,NULL} , {"filename","filename",8,".",1,NULL} , {"filename","filename",8,".",1,NULL},
|
||||||
{"dirname/filename","filename",8,"dirname",7,NULL} , {"dirname/filename","filename",8,"dirname",7,NULL} , {"dirname//filename","filename",8,"dirname",7,NULL},
|
{"dirname/filename","filename",8,"dirname",7,NULL} , {"dirname/filename","filename",8,"dirname",7,NULL} , {"dirname//filename","filename",8,"dirname",7,NULL},
|
||||||
{"dir1name/dir2name/",".",1,"dir1name/dir2name",17}, {"dir1name//dir2name//",".",1,"dir1name//dir2name",18},
|
{"dir1name/dir2name/",".",1,"dir1name/dir2name",17}, {"dir1name//dir2name//",".",1,"dir1name//dir2name",18},
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ static int result;
|
||||||
#define MAX_WORST_ALLOWED 0.1f
|
#define MAX_WORST_ALLOWED 0.1f
|
||||||
|
|
||||||
/* FSP classic algo */
|
/* FSP classic algo */
|
||||||
static unsigned short classic PROTO0((void))
|
static unsigned short classic (void)
|
||||||
{
|
{
|
||||||
unsigned long k;
|
unsigned long k;
|
||||||
|
|
||||||
|
|
@ -21,13 +21,13 @@ static unsigned short classic PROTO0((void))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get low bits from random result */
|
/* get low bits from random result */
|
||||||
static unsigned short simple PROTO0((void))
|
static unsigned short simple (void)
|
||||||
{
|
{
|
||||||
return random();
|
return random();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get high bits from random result - better */
|
/* get high bits from random result - better */
|
||||||
static unsigned short simple2 PROTO0((void))
|
static unsigned short simple2 (void)
|
||||||
{
|
{
|
||||||
return (random() >> 15);
|
return (random() >> 15);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user