diff --git a/lib/security.c b/lib/security.c index 653772ab34..c8add69917 100644 --- a/lib/security.c +++ b/lib/security.c @@ -278,32 +278,6 @@ Curl_sec_write(struct connectdata *conn, int fd, char *buffer, int length) return tx; } -int -Curl_sec_vfprintf2(struct connectdata *conn, FILE *f, const char *fmt, va_list ap) -{ - char *buf; - int ret; - if(conn->data_prot == prot_clear) - return vfprintf(f, fmt, ap); - else { - buf = aprintf(fmt, ap); - ret = buffer_write(&conn->out_buffer, buf, strlen(buf)); - free(buf); - return ret; - } -} - -int -Curl_sec_fprintf2(struct connectdata *conn, FILE *f, const char *fmt, ...) -{ - int ret; - va_list ap; - va_start(ap, fmt); - ret = Curl_sec_vfprintf2(conn, f, fmt, ap); - va_end(ap); - return ret; -} - int Curl_sec_putc(struct connectdata *conn, int c, FILE *F) { @@ -313,7 +287,8 @@ Curl_sec_putc(struct connectdata *conn, int c, FILE *F) buffer_write(&conn->out_buffer, &ch, 1); if(c == '\n' || conn->out_buffer.index >= 1024 /* XXX */) { - Curl_sec_write(conn, fileno(F), conn->out_buffer.data, conn->out_buffer.index); + Curl_sec_write(conn, fileno(F), conn->out_buffer.data, + conn->out_buffer.index); conn->out_buffer.index = 0; } return c; @@ -346,53 +321,6 @@ Curl_sec_read_msg(struct connectdata *conn, char *s, int level) return code; } -/* modified to return how many bytes written, or -1 on error ***/ -int -Curl_sec_vfprintf(struct connectdata *conn, FILE *f, const char *fmt, va_list ap) -{ - int ret = 0; - char *buf; - void *enc; - int len; - if(!conn->sec_complete) - return vfprintf(f, fmt, ap); - - buf = aprintf(fmt, ap); - len = (conn->mech->encode)(conn->app_data, buf, strlen(buf), - conn->command_prot, &enc, - conn); - free(buf); - if(len < 0) { - failf(conn->data, "Failed to encode command."); - return -1; - } - if(Curl_base64_encode(enc, len, &buf) < 0){ - failf(conn->data, "Out of memory base64-encoding."); - return -1; - } - if(conn->command_prot == prot_safe) - ret = fprintf(f, "MIC %s", buf); - else if(conn->command_prot == prot_private) - ret = fprintf(f, "ENC %s", buf); - else if(conn->command_prot == prot_confidential) - ret = fprintf(f, "CONF %s", buf); - - free(buf); - return ret; -} - -int -Curl_sec_fprintf(struct connectdata *conn, FILE *f, const char *fmt, ...) -{ - va_list ap; - int ret; - va_start(ap, fmt); - ret = Curl_sec_vfprintf(conn, f, fmt, ap); - va_end(ap); - return ret; -} - - enum protection_level Curl_set_command_prot(struct connectdata *conn, enum protection_level level) {