Example #1
0
/* Matches Curl_send signature */
static ssize_t sec_send(struct connectdata *conn, int sockindex,
                        const void *buffer, size_t len, CURLcode *err)
{
  curl_socket_t fd = conn->sock[sockindex];
  *err = CURLE_OK;
  return sec_write(conn, fd, buffer, len);
}
Example #2
0
static ssize_t ps_write(Socket *sockp, const void* buf, size_t num)
{
#ifdef SECFTP
  return sec_write(sockp->data->handle, buf, num);
#else
  return write(sockp->data->handle, buf, num);
#endif
}
Example #3
0
void main()
{
        FILE *a;
        long x[64];
        long b;
        memset(x,0,64*sizeof(long));
        a=fopen("/usr/tmp/-iy7AM","w");
        x[0]=1;
        x[1]=1;
        sec_write(a,x,0,64);
        b=0;
        while(b<600)
        {
                sec_write(a,x,b,64);
                x[0]=0;
                b++;
        }
        fclose(a);
}
Example #4
0
int sec_fflush(FILE * F)
{
	if (ftp->data_prot != prot_clear) {
		if (ftp->out_buffer.index > 0) {
			sec_write(fileno(F), ftp->out_buffer.data, ftp->out_buffer.index);
			ftp->out_buffer.index = 0;
		}
		sec_send(fileno(F), NULL, 0);
	}
	fflush(F);
	return 0;
}
Example #5
0
static int FILE_send_binary(FILE *in, FILE *out)
{
	size_t n;
	char *buf;
	time_t then = time(0) - 1;
	time_t now;

	ftp_set_close_handler();

	if(foo_hookf)
		foo_hookf(&ftp->ti);
	ftp->ti.begin = false;

	clearerr(in);
	clearerr(out);

	buf = (char *)xmalloc(FTP_BUFSIZ);
	while(!feof(in)) {
		n = fread(buf, sizeof(char), FTP_BUFSIZ, in);
		if(n <= 0)
			break;

		if(ftp_sigints() > 0)
			break;

		if(wait_for_output() != 0)
			break;
#ifdef SECFTP
		if(sec_write(fileno(out), buf, n) != n)
			break;
#else
		if(fwrite(buf, sizeof(char), n, out) != n)
			break;
#endif
		ftp->ti.size += n;
		if(foo_hookf) {
			now = time(0);
			if(now > then) {
				foo_hookf(&ftp->ti);
				then = now;
			}
		}
	}
#ifdef SECFTP
	sec_fflush(out);
#endif

	free(buf);

	return maybe_abort(in, out);
}
Example #6
0
int sec_putc(int c, FILE * F)
{
	char ch = c;

	if (ftp->data_prot == prot_clear)
		return putc(c, F);

	buffer_write(&ftp->out_buffer, &ch, 1);
	if (c == '\n' || ftp->out_buffer.index >= 1024 /* XXX */ ) {
		sec_write(fileno(F), ftp->out_buffer.data, ftp->out_buffer.index);
		ftp->out_buffer.index = 0;
	}
	return c;
}