Ejemplo n.º 1
0
static int my_send_file(struct asfd *asfd, struct FF_PKT *ff, struct conf **confs)
{
	static struct sbuf *sb=NULL;
	struct cntr *cntr=get_cntr(confs);

	if(!sb && !(sb=sbuf_alloc(get_protocol(confs)))) return -1;

#ifdef HAVE_WIN32
	if(ff->winattr & FILE_ATTRIBUTE_ENCRYPTED)
	{
		if(ff->type==FT_REG
		  || ff->type==FT_DIR)
			return to_server(asfd, confs, ff, sb, CMD_EFS_FILE);
		return logw(asfd, cntr,
			"EFS type %d not yet supported: %s\n",
			ff->type, ff->fname);
	}
#endif

	switch(ff->type)
	{
		case FT_REG:
		case FT_RAW:
		case FT_FIFO:
			return do_to_server(asfd, confs, ff, sb, filesymbol,
				in_exclude_comp(get_strlist(confs[OPT_EXCOM]),
				  ff->fname, get_int(confs[OPT_COMPRESSION])));
		case FT_DIR:
		case FT_REPARSE:
		case FT_JUNCTION:
			return to_server(asfd, confs, ff, sb, dirsymbol);
		case FT_LNK_S:
			return to_server(asfd, confs, ff, sb, CMD_SOFT_LINK);
		case FT_LNK_H:
			return to_server(asfd, confs, ff, sb, CMD_HARD_LINK);
		case FT_SPEC:
			return to_server(asfd, confs, ff, sb, CMD_SPECIAL);
		case FT_NOFSCHG:
			return ft_err(asfd, confs, ff, "Will not descend: "
				"file system change not allowed");
		case FT_NOFOLLOW:
			return ft_err(asfd, confs, ff, "Could not follow link");
		case FT_NOSTAT:
			return ft_err(asfd, confs, ff, "Could not stat");
		case FT_NOOPEN:
			return ft_err(asfd, confs, ff, "Could not open directory");
		default:
			return logw(asfd, cntr,
				"Err: Unknown file type %d: %s\n",
				ff->type, ff->fname);
	}
}
Ejemplo n.º 2
0
int send_file(struct asfd *asfd, FF_PKT *ff, bool top_level, struct conf *conf)
{
	static struct sbuf *sb=NULL;

	if(!sb && !(sb=sbuf_alloc(conf))) return -1;

	if(!file_is_included(conf, ff->fname, top_level)) return 0;

#ifdef HAVE_WIN32
	if(ff->winattr & FILE_ATTRIBUTE_ENCRYPTED)
	{
		if(ff->type==FT_REG
		  || ff->type==FT_DIR)
			return to_server(asfd, conf, ff, sb, CMD_EFS_FILE);
		return logw(asfd, conf, "EFS type %d not yet supported: %s",
			ff->type, ff->fname);
	}
#endif

	switch(ff->type)
	{
		case FT_REG:
		case FT_RAW:
		case FT_FIFO:
			return do_to_server(asfd, conf, ff, sb, filesymbol,
				in_exclude_comp(conf->excom,
					ff->fname, conf->compression));
		case FT_DIR:
		case FT_REPARSE:
		case FT_JUNCTION:
			return to_server(asfd, conf, ff, sb, dirsymbol);
		case FT_LNK_S:
			return to_server(asfd, conf, ff, sb, CMD_SOFT_LINK);
		case FT_LNK_H:
			return to_server(asfd, conf, ff, sb, CMD_HARD_LINK);
		case FT_SPEC:
			return to_server(asfd, conf, ff, sb, CMD_SPECIAL);
		case FT_NOFSCHG:
			return logw(asfd, conf, "Dir: %s [will not descend: "
				"file system change not allowed]\n", ff->fname);
		case FT_NOFOLLOW:
			return ft_err(asfd, conf, ff, "Could not follow link");
		case FT_NOSTAT:
			return ft_err(asfd, conf, ff, "Could not stat");
		case FT_NOOPEN:
			return ft_err(asfd, conf, ff, "Could not open directory");
		default:
			return logw(asfd, conf,
				_("Err: Unknown file type %d: %s"),
				ff->type, ff->fname);
	}
}
Ejemplo n.º 3
0
static int to_server(struct asfd *asfd, struct conf **confs, struct FF_PKT *ff,
	struct sbuf *sb, enum cmd cmd)
{
	return do_to_server(asfd, confs,
		ff, sb, cmd, get_int(confs[OPT_COMPRESSION]));
}
Ejemplo n.º 4
0
static int to_server(struct asfd *asfd, struct conf *conf, FF_PKT *ff,
	struct sbuf *sb, char cmd)
{
	return do_to_server(asfd, conf, ff, sb, cmd, conf->compression);
}