1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#include <stdio.h> /* FILENAME_MAX */
#include "config.h"
#define MAX_USERNAME 32
#define MAX_REQUEST (1024) /* any request exceeding this is truncated */
#define MAX_ARGC 100 /* be reasonable */
#define MAX_ENV 50 /* be reasonable */
#define ALLOWABLE "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890 ./-*\\_\'\":?()+="
#define WHITE " \t" /* whitespace */
#define exact_match(x,y) (0==strcmp(x,y)) /* we dont want strncpy for this */
#define LOGIDENT "scponly"
#define WINSCP_EOF_REQ_RETVAL " ; echo \"WinSCP: this is end-of-file:$?\""
#define WINSCP_EOF_REQ_ZERO " ; echo \"WinSCP: this is end-of-file:0\""
#define WINSCP_EOF_REQ_STATUS " ; echo \"WinSCP: this is end-of-file:$status\""
#define WINSCP_BOF_REQ "echo \"WinSCP: this is begin-of-file\" ; "
#define WINSCP_EOF "WinSCP: this is end-of-file:"
#define WINSCP_BOF "WinSCP: this is begin-of-file"
typedef struct
{
char *name;
int argflag;
} cmd_t;
typedef struct
{
char *name;
int getoptflag;
int strict;
char *badarg;
char *opts;
} cmd_arg_t;
/*
* function prototypes
*/
inline char *strbeg (char *, char *);
inline char *strend (char *, char *);
int valid_chars(char *);
int get_uservar(void);
void show_usage(void);
char *logstamp();
int cntchr(char *, char);
char **build_arg_vector(char *);
char **expand_wildcards(char **);
int valid_arg_vector(char **);
char *substitute_known_path(char *);
char *flatten_vector(char **);
void discard_vector(char **);
int check_dangerous_args(char **av);
|