version 1.172.2.1, 2019/12/19 16:50:22 |
version 1.173, 2019/10/13 15:07:13 |
|
|
int ftp_printf(FILE *, struct tls *, const char *, ...) __attribute__((format(printf, 3, 4))); |
int ftp_printf(FILE *, struct tls *, const char *, ...) __attribute__((format(printf, 3, 4))); |
char *ftp_readline(FILE *, struct tls *, size_t *); |
char *ftp_readline(FILE *, struct tls *, size_t *); |
size_t ftp_read(FILE *, struct tls *, char *, size_t); |
size_t ftp_read(FILE *, struct tls *, char *, size_t); |
|
void ftp_close(FILE **fin, struct tls **tls, volatile int *fd); |
#ifndef NOSSL |
#ifndef NOSSL |
int proxy_connect(int, char *, char *); |
int proxy_connect(int, char *, char *); |
int SSL_vprintf(struct tls *, const char *, va_list); |
int SSL_vprintf(struct tls *, const char *, va_list); |
|
|
} else |
} else |
errx(1, "url_get: Invalid URL '%s'", newline); |
errx(1, "url_get: Invalid URL '%s'", newline); |
|
|
if (isfileurl && redirect_loop > 0) |
|
errx(1, "Redirection to local file not permitted"); |
|
|
|
if (isfileurl) { |
if (isfileurl) { |
path = host; |
path = host; |
} else { |
} else { |
|
|
*loctail = '\0'; |
*loctail = '\0'; |
if (verbose) |
if (verbose) |
fprintf(ttyout, "Redirected to %s\n", redirurl); |
fprintf(ttyout, "Redirected to %s\n", redirurl); |
if (fin != NULL) { |
ftp_close(&fin, &tls, &fd); |
fclose(fin); |
|
fin = NULL; |
|
} |
|
if (fd != -1) { |
|
close(fd); |
|
fd = -1; |
|
} |
|
rval = url_get(redirurl, proxyenv, savefile, lastfile); |
rval = url_get(redirurl, proxyenv, savefile, lastfile); |
free(redirurl); |
free(redirurl); |
goto cleanup_url_get; |
goto cleanup_url_get; |
|
|
|
|
cleanup_url_get: |
cleanup_url_get: |
#ifndef NOSSL |
#ifndef NOSSL |
if (tls != NULL) { |
|
if (tls_session_fd != -1) |
|
dprintf(STDERR_FILENO, "tls session resumed: %s\n", |
|
tls_conn_session_resumed(tls) ? "yes" : "no"); |
|
do { |
|
i = tls_close(tls); |
|
} while (i == TLS_WANT_POLLIN || i == TLS_WANT_POLLOUT); |
|
tls_free(tls); |
|
} |
|
free(full_host); |
free(full_host); |
free(sslhost); |
free(sslhost); |
#endif /* !NOSSL */ |
#endif /* !NOSSL */ |
if (fin != NULL) { |
ftp_close(&fin, &tls, &fd); |
fclose(fin); |
|
fin = NULL; |
|
} |
|
if (fd != -1) { |
|
close(fd); |
|
fd = -1; |
|
} |
|
if (out >= 0 && out != fileno(stdout)) |
if (out >= 0 && out != fileno(stdout)) |
close(out); |
close(out); |
free(buf); |
free(buf); |
|
|
} |
} |
#endif /* !SMALL */ |
#endif /* !SMALL */ |
return (ret); |
return (ret); |
|
} |
|
|
|
void |
|
ftp_close(FILE **fin, struct tls **tls, volatile int *fd) |
|
{ |
|
#ifndef NOSSL |
|
int ret; |
|
|
|
if (*tls != NULL) { |
|
if (tls_session_fd != -1) |
|
dprintf(STDERR_FILENO, "tls session resumed: %s\n", |
|
tls_conn_session_resumed(*tls) ? "yes" : "no"); |
|
do { |
|
ret = tls_close(*tls); |
|
} while (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT); |
|
tls_free(*tls); |
|
*tls = NULL; |
|
} |
|
#endif |
|
if (*fin != NULL) { |
|
fclose(*fin); |
|
*fin = NULL; |
|
} |
|
if (*fd != -1) { |
|
close(*fd); |
|
*fd = -1; |
|
} |
} |
} |
|
|
#ifndef NOSSL |
#ifndef NOSSL |