aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2008-05-09 11:27:54 +0000
committerMichal Marek <mmarek@suse.cz>2008-05-09 11:27:54 +0000
commite2b82b4325e2726a802b6202f2d011fb4988e41d (patch)
tree801a800650fb9db2f1b21faca42578c13c6ca653
parentcf4570a06fb8103560d967af2fc93d3193fcbc04 (diff)
- Make Curl_write and it's callees accept a const pointer, in preparation
of tetetest's patch for curl_easy_send()
-rw-r--r--CHANGES4
-rw-r--r--lib/krb4.c9
-rw-r--r--lib/krb4.h6
-rw-r--r--lib/krb5.c7
-rw-r--r--lib/security.c6
-rw-r--r--lib/sendf.c4
-rw-r--r--lib/sendf.h2
-rw-r--r--lib/ssh.c4
-rw-r--r--lib/ssh.h4
-rw-r--r--lib/sslgen.c2
-rw-r--r--lib/sslgen.h2
-rw-r--r--lib/ssluse.c2
-rw-r--r--lib/ssluse.h2
13 files changed, 32 insertions, 22 deletions
diff --git a/CHANGES b/CHANGES
index 51b5bbe66..52b50a8eb 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,10 @@
Changelog
+Michal Marek (9 May 2008)
+- Make Curl_write and it's callees accept a const pointer, in preparation
+ of tetetest's patch for curl_easy_send()
+
Daniel Stenberg (7 May 2008)
- Liam Healy filed the debian bug report #480044
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=480044) identifying a
diff --git a/lib/krb4.c b/lib/krb4.c
index 4ea21e2cb..42ae753c5 100644
--- a/lib/krb4.c
+++ b/lib/krb4.c
@@ -151,17 +151,20 @@ krb4_overhead(void *app_data, int level, int len)
}
static int
-krb4_encode(void *app_data, void *from, int length, int level, void **to,
+krb4_encode(void *app_data, const void *from, int length, int level, void **to,
struct connectdata *conn)
{
struct krb4_data *d = app_data;
*to = malloc(length + 31);
if(level == prot_safe)
- return krb_mk_safe(from, *to, length, &d->key,
+ /* NOTE that the void* cast is safe, krb_mk_safe/priv don't modify the
+ * input buffer
+ */
+ return krb_mk_safe((void*)from, *to, length, &d->key,
(struct sockaddr_in *)LOCAL_ADDR,
(struct sockaddr_in *)REMOTE_ADDR);
else if(level == prot_private)
- return krb_mk_priv(from, *to, length, d->schedule, &d->key,
+ return krb_mk_priv((void*)from, *to, length, d->schedule, &d->key,
(struct sockaddr_in *)LOCAL_ADDR,
(struct sockaddr_in *)REMOTE_ADDR);
else
diff --git a/lib/krb4.h b/lib/krb4.h
index 405454ccb..43cf78d93 100644
--- a/lib/krb4.h
+++ b/lib/krb4.h
@@ -31,7 +31,7 @@ struct Curl_sec_client_mech {
void (*end)(void *);
int (*check_prot)(void *, int);
int (*overhead)(void *, int, int);
- int (*encode)(void *, void*, int, int, void**, struct connectdata *);
+ int (*encode)(void *, const void*, int, int, void**, struct connectdata *);
int (*decode)(void *, void*, int, int, struct connectdata *);
};
@@ -58,8 +58,8 @@ int Curl_sec_read_msg (struct connectdata *conn, char *, int);
int Curl_sec_vfprintf(struct connectdata *, FILE *, const char *, va_list);
int Curl_sec_fprintf2(struct connectdata *conn, FILE *f, const char *fmt, ...);
int Curl_sec_vfprintf2(struct connectdata *conn, FILE *, const char *, va_list);
-ssize_t Curl_sec_send(struct connectdata *conn, int, char *, int);
-int Curl_sec_write(struct connectdata *conn, int, char *, int);
+ssize_t Curl_sec_send(struct connectdata *conn, int, const char *, int);
+int Curl_sec_write(struct connectdata *conn, int, const char *, int);
void Curl_sec_end (struct connectdata *);
int Curl_sec_login (struct connectdata *);
diff --git a/lib/krb5.c b/lib/krb5.c
index 2c284078e..22aef1699 100644
--- a/lib/krb5.c
+++ b/lib/krb5.c
@@ -116,7 +116,7 @@ krb5_overhead(void *app_data, int level, int len)
}
static int
-krb5_encode(void *app_data, void *from, int length, int level, void **to,
+krb5_encode(void *app_data, const void *from, int length, int level, void **to,
struct connectdata *conn)
{
gss_ctx_id_t *context = app_data;
@@ -128,7 +128,10 @@ krb5_encode(void *app_data, void *from, int length, int level, void **to,
/* shut gcc up */
conn = NULL;
- dec.value = from;
+ /* NOTE that the cast is safe, neither of the krb5, gnu gss and heimdal
+ * libraries modify the input buffer in gss_seal()
+ */
+ dec.value = (void*)from;
dec.length = length;
maj = gss_seal(&min, *context,
level == prot_private,
diff --git a/lib/security.c b/lib/security.c
index 0454f094c..a07da0b1e 100644
--- a/lib/security.c
+++ b/lib/security.c
@@ -237,7 +237,7 @@ Curl_sec_read(struct connectdata *conn, int fd, void *buffer, int length)
}
static int
-sec_send(struct connectdata *conn, int fd, char *from, int length)
+sec_send(struct connectdata *conn, int fd, const char *from, int length)
{
int bytes;
void *buf;
@@ -292,7 +292,7 @@ Curl_sec_fflush_fd(struct connectdata *conn, int fd)
}
int
-Curl_sec_write(struct connectdata *conn, int fd, char *buffer, int length)
+Curl_sec_write(struct connectdata *conn, int fd, const char *buffer, int length)
{
int len = conn->buffer_size;
int tx = 0;
@@ -315,7 +315,7 @@ Curl_sec_write(struct connectdata *conn, int fd, char *buffer, int length)
}
ssize_t
-Curl_sec_send(struct connectdata *conn, int num, char *buffer, int length)
+Curl_sec_send(struct connectdata *conn, int num, const char *buffer, int length)
{
curl_socket_t fd = conn->sock[num];
return (ssize_t)Curl_sec_write(conn, fd, buffer, length);
diff --git a/lib/sendf.c b/lib/sendf.c
index 6aa4d8613..3869a4d4f 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -312,7 +312,7 @@ CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *conn,
static ssize_t send_plain(struct connectdata *conn,
int num,
- void *mem,
+ const void *mem,
size_t len)
{
curl_socket_t sockfd = conn->sock[num];
@@ -347,7 +347,7 @@ static ssize_t send_plain(struct connectdata *conn,
*/
CURLcode Curl_write(struct connectdata *conn,
curl_socket_t sockfd,
- void *mem,
+ const void *mem,
size_t len,
ssize_t *written)
{
diff --git a/lib/sendf.h b/lib/sendf.h
index f8808f662..7ffa4768a 100644
--- a/lib/sendf.h
+++ b/lib/sendf.h
@@ -65,7 +65,7 @@ int Curl_read(struct connectdata *conn, curl_socket_t sockfd,
/* internal write-function, does plain socket, SSL and krb4 */
CURLcode Curl_write(struct connectdata *conn,
curl_socket_t sockfd,
- void *mem, size_t len,
+ const void *mem, size_t len,
ssize_t *written);
/* the function used to output verbose information */
diff --git a/lib/ssh.c b/lib/ssh.c
index 5d82b53c2..276127f24 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -2199,7 +2199,7 @@ static CURLcode scp_done(struct connectdata *conn, CURLcode status,
/* return number of received (decrypted) bytes */
ssize_t Curl_scp_send(struct connectdata *conn, int sockindex,
- void *mem, size_t len)
+ const void *mem, size_t len)
{
ssize_t nwrite;
(void)sockindex; /* we only support SCP on the fixed known primary socket */
@@ -2347,7 +2347,7 @@ static CURLcode sftp_done(struct connectdata *conn, CURLcode status,
/* return number of sent bytes */
ssize_t Curl_sftp_send(struct connectdata *conn, int sockindex,
- void *mem, size_t len)
+ const void *mem, size_t len)
{
ssize_t nwrite; /* libssh2_sftp_write() used to return size_t in 0.14
but is changed to ssize_t in 0.15. These days we don't
diff --git a/lib/ssh.h b/lib/ssh.h
index 8ac2a41ee..e87b21ba3 100644
--- a/lib/ssh.h
+++ b/lib/ssh.h
@@ -29,12 +29,12 @@ extern const struct Curl_handler Curl_handler_scp;
extern const struct Curl_handler Curl_handler_sftp;
ssize_t Curl_scp_send(struct connectdata *conn, int sockindex,
- void *mem, size_t len);
+ const void *mem, size_t len);
ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex,
char *mem, size_t len);
ssize_t Curl_sftp_send(struct connectdata *conn, int sockindex,
- void *mem, size_t len);
+ const void *mem, size_t len);
ssize_t Curl_sftp_recv(struct connectdata *conn, int sockindex,
char *mem, size_t len);
diff --git a/lib/sslgen.c b/lib/sslgen.c
index bbcc8c56d..b25cbddf2 100644
--- a/lib/sslgen.c
+++ b/lib/sslgen.c
@@ -578,7 +578,7 @@ struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data)
/* return number of sent (non-SSL) bytes */
ssize_t Curl_ssl_send(struct connectdata *conn,
int sockindex,
- void *mem,
+ const void *mem,
size_t len)
{
#ifdef USE_SSLEAY
diff --git a/lib/sslgen.h b/lib/sslgen.h
index 391b8f33e..d93225dd8 100644
--- a/lib/sslgen.h
+++ b/lib/sslgen.h
@@ -44,7 +44,7 @@ CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine);
CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data);
ssize_t Curl_ssl_send(struct connectdata *conn,
int sockindex,
- void *mem,
+ const void *mem,
size_t len);
ssize_t Curl_ssl_recv(struct connectdata *conn, /* connection data */
int sockindex, /* socketindex */
diff --git a/lib/ssluse.c b/lib/ssluse.c
index 6d013a291..e5e1f6708 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -1872,7 +1872,7 @@ Curl_ossl_connect(struct connectdata *conn,
/* return number of sent (non-SSL) bytes */
ssize_t Curl_ossl_send(struct connectdata *conn,
int sockindex,
- void *mem,
+ const void *mem,
size_t len)
{
/* SSL_write() is said to return 'int' while write() and send() returns
diff --git a/lib/ssluse.h b/lib/ssluse.h
index d5424d5a6..9707c0581 100644
--- a/lib/ssluse.h
+++ b/lib/ssluse.h
@@ -58,7 +58,7 @@ void Curl_ossl_cleanup(void);
ssize_t Curl_ossl_send(struct connectdata *conn,
int sockindex,
- void *mem,
+ const void *mem,
size_t len);
ssize_t Curl_ossl_recv(struct connectdata *conn, /* connection data */
int num, /* socketindex */