summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-05-05 14:22:11 -0700
committerJeremy Allison <jra@samba.org>2011-05-05 23:56:07 +0200
commit02af3075858814811bc30f03623eb6715f9b7a78 (patch)
tree10e10b4df41d6a8059ca136e76901f2a8af5bce4 /source3
parente131c94ac1b06cc49b1c25717d3496dba8b0b3df (diff)
downloadsamba-02af3075858814811bc30f03623eb6715f9b7a78.tar.gz
samba-02af3075858814811bc30f03623eb6715f9b7a78.tar.bz2
samba-02af3075858814811bc30f03623eb6715f9b7a78.zip
More simple const fixes.
Diffstat (limited to 'source3')
-rw-r--r--source3/auth/pass_check.c16
-rw-r--r--source3/lib/filename_util.c4
-rw-r--r--source3/lib/util_str.c4
-rw-r--r--source3/libnet/libnet_dssync_passdb.c2
-rw-r--r--source3/libsmb/namequery.c22
-rw-r--r--source3/libsmb/nmblib.c2
-rw-r--r--source3/libsmb/nmblib.h2
-rw-r--r--source3/libsmb/trusts_util.c2
-rw-r--r--source3/locking/brlock.c4
-rw-r--r--source3/nmbd/nmbd.c6
-rw-r--r--source3/nmbd/nmbd_packets.c10
-rw-r--r--source3/nmbd/nmbd_processlogon.c6
-rw-r--r--source3/nmbd/nmbd_subnetdb.c2
-rw-r--r--source3/printing/notify.c2
-rw-r--r--source3/printing/nt_printing_migrate.c4
-rw-r--r--source3/smbd/lanman.c8
-rw-r--r--source3/smbd/msdfs.c2
-rw-r--r--source3/smbd/notify_internal.c2
-rw-r--r--source3/smbd/sesssetup.c4
-rw-r--r--source3/smbd/smb2_server.c8
-rw-r--r--source3/smbd/smb2_sesssetup.c2
-rw-r--r--source3/smbd/smb2_tcon.c2
22 files changed, 58 insertions, 58 deletions
diff --git a/source3/auth/pass_check.c b/source3/auth/pass_check.c
index a7a1c3d8f5..714cc968a7 100644
--- a/source3/auth/pass_check.c
+++ b/source3/auth/pass_check.c
@@ -502,8 +502,8 @@ it assumes the string starts lowercased
****************************************************************************/
static NTSTATUS string_combinations2(char *s, int offset,
NTSTATUS (*fn)(const char *s,
- void *private_data),
- int N, void *private_data)
+ const void *private_data),
+ int N, const void *private_data)
{
int len = strlen(s);
int i;
@@ -540,8 +540,8 @@ it assumes the string starts lowercased
****************************************************************************/
static NTSTATUS string_combinations(char *s,
NTSTATUS (*fn)(const char *s,
- void *private_data),
- int N, void *private_data)
+ const void *private_data),
+ int N, const void *private_data)
{
int n;
NTSTATUS nt_status;
@@ -558,7 +558,7 @@ static NTSTATUS string_combinations(char *s,
/****************************************************************************
core of password checking routine
****************************************************************************/
-static NTSTATUS password_check(const char *password, void *private_data)
+static NTSTATUS password_check(const char *password, const void *private_data)
{
#ifdef WITH_PAM
const char *rhost = (const char *)private_data;
@@ -840,7 +840,7 @@ NTSTATUS pass_check(const struct passwd *pass,
#endif /* defined(WITH_PAM) */
/* try it as it came to us */
- nt_status = password_check(password, (void *)rhost);
+ nt_status = password_check(password, (const void *)rhost);
if NT_STATUS_IS_OK(nt_status) {
return (nt_status);
} else if (!NT_STATUS_EQUAL(nt_status, NT_STATUS_WRONG_PASSWORD)) {
@@ -868,7 +868,7 @@ NTSTATUS pass_check(const struct passwd *pass,
/* try all lowercase if it's currently all uppercase */
if (strhasupper(pass2)) {
strlower_m(pass2);
- nt_status = password_check(pass2, (void *)rhost);
+ nt_status = password_check(pass2, (const void *)rhost);
if (NT_STATUS_IS_OK(nt_status)) {
return (nt_status);
}
@@ -883,7 +883,7 @@ NTSTATUS pass_check(const struct passwd *pass,
strlower_m(pass2);
nt_status = string_combinations(pass2, password_check, level,
- (void *)rhost);
+ (const void *)rhost);
if (NT_STATUS_IS_OK(nt_status)) {
return nt_status;
}
diff --git a/source3/lib/filename_util.c b/source3/lib/filename_util.c
index aad8a08e2b..d24660c981 100644
--- a/source3/lib/filename_util.c
+++ b/source3/lib/filename_util.c
@@ -60,8 +60,8 @@ NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
ZERO_STRUCT(smb_fname_loc);
/* Setup the base_name/stream_name. */
- smb_fname_loc.base_name = CONST_DISCARD(char *, base_name);
- smb_fname_loc.stream_name = CONST_DISCARD(char *, stream_name);
+ smb_fname_loc.base_name = discard_const_p(char, base_name);
+ smb_fname_loc.stream_name = discard_const_p(char, stream_name);
/* Copy the psbuf if one was given. */
if (psbuf)
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 583eea40d9..3dc73d9b8e 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -387,7 +387,7 @@ static bool string_init(char **dest,const char *src)
l = strlen(src);
if (l == 0) {
- *dest = CONST_DISCARD(char*, null_string);
+ *dest = discard_const_p(char, null_string);
} else {
(*dest) = SMB_STRDUP(src);
if ((*dest) == NULL) {
@@ -684,7 +684,7 @@ char *strnrchr_m(const char *s, char c, unsigned int n)
/* Too hard to try and get right. */
return NULL;
}
- ret = (char *)(s+strlen(s2));
+ ret = discard_const_p(char, (s+strlen(s2)));
TALLOC_FREE(ws);
TALLOC_FREE(s2);
return ret;
diff --git a/source3/libnet/libnet_dssync_passdb.c b/source3/libnet/libnet_dssync_passdb.c
index 768ca49d7e..349b25a987 100644
--- a/source3/libnet/libnet_dssync_passdb.c
+++ b/source3/libnet/libnet_dssync_passdb.c
@@ -105,7 +105,7 @@ static struct dssync_passdb_obj *dssync_search_obj_by_guid(struct dssync_passdb
TDB_DATA key;
TDB_DATA data;
- key = make_tdb_data((const uint8_t *)(void *)guid,
+ key = make_tdb_data((const uint8_t *)(const void *)guid,
sizeof(*guid));
ret = db->fetch(db, talloc_tos(), key, &data);
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 8d52ff140c..417d4ffc95 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -963,9 +963,9 @@ static int addr_compare(const struct sockaddr_storage *ss1,
for (i=0;i<num_interfaces;i++) {
const struct sockaddr_storage *pss = iface_n_bcast(i);
- unsigned char *p_ss1 = NULL;
- unsigned char *p_ss2 = NULL;
- unsigned char *p_if = NULL;
+ const unsigned char *p_ss1 = NULL;
+ const unsigned char *p_ss2 = NULL;
+ const unsigned char *p_if = NULL;
size_t len = 0;
int bits1, bits2;
@@ -974,21 +974,21 @@ static int addr_compare(const struct sockaddr_storage *ss1,
continue;
}
if (pss->ss_family == AF_INET) {
- p_if = (unsigned char *)
+ p_if = (const unsigned char *)
&((const struct sockaddr_in *)pss)->sin_addr;
- p_ss1 = (unsigned char *)
+ p_ss1 = (const unsigned char *)
&((const struct sockaddr_in *)ss1)->sin_addr;
- p_ss2 = (unsigned char *)
+ p_ss2 = (const unsigned char *)
&((const struct sockaddr_in *)ss2)->sin_addr;
len = 4;
}
#if defined(HAVE_IPV6)
if (pss->ss_family == AF_INET6) {
- p_if = (unsigned char *)
+ p_if = (const unsigned char *)
&((const struct sockaddr_in6 *)pss)->sin6_addr;
- p_ss1 = (unsigned char *)
+ p_ss1 = (const unsigned char *)
&((const struct sockaddr_in6 *)ss1)->sin6_addr;
- p_ss2 = (unsigned char *)
+ p_ss2 = (const unsigned char *)
&((const struct sockaddr_in6 *)ss2)->sin6_addr;
len = 16;
}
@@ -1003,14 +1003,14 @@ static int addr_compare(const struct sockaddr_storage *ss1,
}
/* Bias towards directly reachable IPs */
- if (iface_local((struct sockaddr *)ss1)) {
+ if (iface_local((const struct sockaddr *)ss1)) {
if (ss1->ss_family == AF_INET) {
max_bits1 += 32;
} else {
max_bits1 += 128;
}
}
- if (iface_local((struct sockaddr *)ss2)) {
+ if (iface_local((const struct sockaddr *)ss2)) {
if (ss2->ss_family == AF_INET) {
max_bits2 += 32;
} else {
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c
index 39243a04f3..f4d5ec7bbb 100644
--- a/source3/libsmb/nmblib.c
+++ b/source3/libsmb/nmblib.c
@@ -1147,7 +1147,7 @@ bool match_mailslot_name(struct packet_struct *p, const char *mailslot_name)
Return the number of bits that match between two len character buffers
***************************************************************************/
-int matching_len_bits(unsigned char *p1, unsigned char *p2, size_t len)
+int matching_len_bits(const unsigned char *p1, const unsigned char *p2, size_t len)
{
size_t i, j;
int ret = 0;
diff --git a/source3/libsmb/nmblib.h b/source3/libsmb/nmblib.h
index a6666a84c6..a64f5818e0 100644
--- a/source3/libsmb/nmblib.h
+++ b/source3/libsmb/nmblib.h
@@ -42,7 +42,7 @@ bool nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
int build_packet(char *buf, size_t buflen, struct packet_struct *p);
bool send_packet(struct packet_struct *p);
bool match_mailslot_name(struct packet_struct *p, const char *mailslot_name);
-int matching_len_bits(unsigned char *p1, unsigned char *p2, size_t len);
+int matching_len_bits(const unsigned char *p1, const unsigned char *p2, size_t len);
void sort_query_replies(char *data, int n, struct in_addr ip);
char *name_mangle(TALLOC_CTX *mem_ctx, const char *In, char name_type);
int name_extract(unsigned char *buf,size_t buf_len, unsigned int ofs, fstring name);
diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index 08377fbfbc..744f577f35 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -220,7 +220,7 @@ bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
}
for (i=0; i< *num_domains; i++) {
- (*domain_names)[i] = CONST_DISCARD(char *, dom_list.domains[i].name.string);
+ (*domain_names)[i] = discard_const_p(char, dom_list.domains[i].name.string);
(*sids)[i] = *dom_list.domains[i].sid;
}
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index c325338062..fd3bf2319e 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -1993,8 +1993,8 @@ static void brl_revalidate_collect(struct file_id id, struct server_id pid,
static int compare_procids(const void *p1, const void *p2)
{
- const struct server_id *i1 = (struct server_id *)p1;
- const struct server_id *i2 = (struct server_id *)p2;
+ const struct server_id *i1 = (const struct server_id *)p1;
+ const struct server_id *i2 = (const struct server_id *)p2;
if (i1->pid < i2->pid) return -1;
if (i2->pid > i2->pid) return 1;
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index f8108d9d52..d8a4b17a07 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -240,8 +240,8 @@ static void reload_interfaces(time_t t)
continue;
}
- ip = ((struct sockaddr_in *)(void *)&iface->ip)->sin_addr;
- nmask = ((struct sockaddr_in *)(void *)
+ ip = ((const struct sockaddr_in *)(const void *)&iface->ip)->sin_addr;
+ nmask = ((const struct sockaddr_in *)(const void *)
&iface->netmask)->sin_addr;
/*
@@ -250,7 +250,7 @@ static void reload_interfaces(time_t t)
* ignore it here. JRA.
*/
- if (is_loopback_addr((struct sockaddr *)(void *)&iface->ip)) {
+ if (is_loopback_addr((const struct sockaddr *)(const void *)&iface->ip)) {
DEBUG(2,("reload_interfaces: Ignoring loopback "
"interface %s\n",
print_sockaddr(str, sizeof(str), &iface->ip) ));
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 36ec13f295..a93e79c908 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -1290,28 +1290,28 @@ packet sent to name %s from IP %s\n",
DEBUG(4,("process_dgram: datagram from %s to %s IP %s for %s of type %d len=%d\n",
nmb_namestr(&dgram->source_name),nmb_namestr(&dgram->dest_name),
- inet_ntoa(p->ip), smb_buf(buf),CVAL(buf2,0),len));
+ inet_ntoa(p->ip), smb_buf_const(buf),CVAL(buf2,0),len));
/* Datagram packet received for the browser mailslot */
- if (strequal(smb_buf(buf),BROWSE_MAILSLOT)) {
+ if (strequal(smb_buf_const(buf),BROWSE_MAILSLOT)) {
process_browse_packet(p,buf2,len);
return;
}
/* Datagram packet received for the LAN Manager mailslot */
- if (strequal(smb_buf(buf),LANMAN_MAILSLOT)) {
+ if (strequal(smb_buf_const(buf),LANMAN_MAILSLOT)) {
process_lanman_packet(p,buf2,len);
return;
}
/* Datagram packet received for the domain logon mailslot */
- if (strequal(smb_buf(buf),NET_LOGON_MAILSLOT)) {
+ if (strequal(smb_buf_const(buf),NET_LOGON_MAILSLOT)) {
process_logon_packet(p,buf2,len,NET_LOGON_MAILSLOT);
return;
}
/* Datagram packet received for the NT domain logon mailslot */
- if (strequal(smb_buf(buf),NT_LOGON_MAILSLOT)) {
+ if (strequal(smb_buf_const(buf),NT_LOGON_MAILSLOT)) {
process_logon_packet(p,buf2,len,NT_LOGON_MAILSLOT);
return;
}
diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c
index 9bb1252a46..790e1c3ce1 100644
--- a/source3/nmbd/nmbd_processlogon.c
+++ b/source3/nmbd/nmbd_processlogon.c
@@ -157,7 +157,7 @@ static void nmbd_proxy_logon_done(struct tevent_req *subreq);
static void nmbd_proxy_logon(struct nmbd_proxy_logon_context *ctx,
struct in_addr local_ip,
struct packet_struct *p,
- uint8_t *buf,
+ const uint8_t *buf,
uint32_t len)
{
struct nmbd_proxy_logon_state *state;
@@ -328,7 +328,7 @@ void process_logon_packet(struct packet_struct *p, const char *buf,int len,
inet_ntoa(p->ip) ));
return;
}
- ip = ((struct sockaddr_in *)pss)->sin_addr;
+ ip = ((const struct sockaddr_in *)pss)->sin_addr;
if (!lp_domain_logons()) {
DEBUG(5,("process_logon_packet: Logon packet received from IP %s and domain \
@@ -459,7 +459,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
if (global_nmbd_proxy_logon) {
nmbd_proxy_logon(global_nmbd_proxy_logon,
- ip, p, (uint8_t *)buf, len);
+ ip, p, (const uint8_t *)buf, len);
return;
}
diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c
index 3a60038dcd..666679a90b 100644
--- a/source3/nmbd/nmbd_subnetdb.c
+++ b/source3/nmbd/nmbd_subnetdb.c
@@ -296,7 +296,7 @@ bool create_subnets(void)
* ignore it here. JRA.
*/
- if (is_loopback_addr((struct sockaddr *)&iface->ip)) {
+ if (is_loopback_addr((const struct sockaddr *)&iface->ip)) {
DEBUG(2,("create_subnets: Ignoring loopback interface.\n" ));
continue;
}
diff --git a/source3/printing/notify.c b/source3/printing/notify.c
index 836f7df3d1..9e4b740859 100644
--- a/source3/printing/notify.c
+++ b/source3/printing/notify.c
@@ -398,7 +398,7 @@ static void send_notify_field_buffer(struct tevent_context *ev,
msg->field = field;
msg->id = id;
msg->len = len;
- msg->notify.data = CONST_DISCARD(char *,buffer);
+ msg->notify.data = discard_const_p(char, buffer);
send_spoolss_notify2_msg(ev, msg_ctx, msg);
}
diff --git a/source3/printing/nt_printing_migrate.c b/source3/printing/nt_printing_migrate.c
index 047d0b3245..7c8736875b 100644
--- a/source3/printing/nt_printing_migrate.c
+++ b/source3/printing/nt_printing_migrate.c
@@ -359,13 +359,13 @@ static NTSTATUS migrate_printer(TALLOC_CTX *mem_ctx,
/* migrate printerdata */
for (j = 0; j < r.count; j++) {
char *valuename;
- char *keyname;
+ const char *keyname;
if (r.printer_data[j].type == REG_NONE) {
continue;
}
- keyname = CONST_DISCARD(char *, r.printer_data[j].name);
+ keyname = r.printer_data[j].name;
valuename = strchr(keyname, '\\');
if (valuename == NULL) {
continue;
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 79737b01b5..b5171867a3 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -612,9 +612,9 @@ static void fill_printq_info_52(struct spoolss_DriverInfo3 *driver,
{
int i;
fstring location;
- trim_string((char *)driver->driver_path, "\\print$\\WIN40\\0\\", 0);
- trim_string((char *)driver->data_file, "\\print$\\WIN40\\0\\", 0);
- trim_string((char *)driver->help_file, "\\print$\\WIN40\\0\\", 0);
+ trim_string(discard_const_p(char, driver->driver_path), "\\print$\\WIN40\\0\\", 0);
+ trim_string(discard_const_p(char, driver->data_file), "\\print$\\WIN40\\0\\", 0);
+ trim_string(discard_const_p(char, driver->help_file), "\\print$\\WIN40\\0\\", 0);
PACKI(desc, "W", 0x0400); /* don't know */
PACKS(desc, "z", driver->driver_name); /* long printer name */
@@ -641,7 +641,7 @@ static void fill_printq_info_52(struct spoolss_DriverInfo3 *driver,
for ( i=0; i<count && driver->dependent_files && *driver->dependent_files[i]; i++)
{
- trim_string((char *)driver->dependent_files[i], "\\print$\\WIN40\\0\\", 0);
+ trim_string(discard_const_p(char, driver->dependent_files[i]), "\\print$\\WIN40\\0\\", 0);
PACKS(desc,"z",driver->dependent_files[i]); /* driver files to copy */
DEBUG(3,("Dependent File: %s:\n", driver->dependent_files[i]));
}
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index ab67ac8596..82abda79de 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -1786,7 +1786,7 @@ NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
* Once srvstr_get_path() uses talloc it'll
* be a talloced ptr anyway.
*/
- *pp_name_out = CONST_DISCARD(char *,name_in);
+ *pp_name_out = discard_const_p(char, name_in);
}
return status;
}
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index a8eaf79392..050f931122 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -597,7 +597,7 @@ NTSTATUS notify_remove_onelevel(struct notify_context *notify,
rec = notify->db_onelevel->fetch_locked(
notify->db_onelevel, array,
- make_tdb_data((uint8_t *)fid, sizeof(*fid)));
+ make_tdb_data((const uint8_t *)fid, sizeof(*fid)));
if (rec == NULL) {
DEBUG(10, ("notify_remove_onelevel: fetch_locked for %s failed"
"\n", file_id_string_tos(fid)));
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index 3631d589f5..026380e3e6 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -1043,7 +1043,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + blob1.length;
+ p2 = (const char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,
STR_TERMINATE);
@@ -1685,7 +1685,7 @@ void reply_sesssetup_and_X(struct smb_request *req)
data_blob_free(&lm_resp);
SSVAL(req->outbuf,smb_uid,sess_vuid);
- SSVAL(req->inbuf,smb_uid,sess_vuid);
+ SSVAL(discard_const_p(char, req->inbuf),smb_uid,sess_vuid);
req->vuid = sess_vuid;
if (!sconn->smb1.sessions.done_sesssetup) {
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 7cbe90a773..1bb3cc22ce 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -269,15 +269,15 @@ static NTSTATUS smbd_smb2_request_create(struct smbd_server_connection *sconn,
memcpy(req->in.nbt_hdr, inbuf, 4);
ofs = 0;
- req->in.vector[0].iov_base = (void *)req->in.nbt_hdr;
+ req->in.vector[0].iov_base = discard_const_p(void, req->in.nbt_hdr);
req->in.vector[0].iov_len = 4;
ofs += req->in.vector[0].iov_len;
- req->in.vector[1].iov_base = (void *)(inbuf + ofs);
+ req->in.vector[1].iov_base = discard_const_p(void, (inbuf + ofs));
req->in.vector[1].iov_len = SMB2_HDR_BODY;
ofs += req->in.vector[1].iov_len;
- req->in.vector[2].iov_base = (void *)(inbuf + ofs);
+ req->in.vector[2].iov_base = discard_const_p(void, (inbuf + ofs));
req->in.vector[2].iov_len = SVAL(inbuf, ofs) & 0xFFFE;
ofs += req->in.vector[2].iov_len;
@@ -285,7 +285,7 @@ static NTSTATUS smbd_smb2_request_create(struct smbd_server_connection *sconn,
return NT_STATUS_INVALID_PARAMETER;
}
- req->in.vector[3].iov_base = (void *)(inbuf + ofs);
+ req->in.vector[3].iov_base = discard_const_p(void, (inbuf + ofs));
req->in.vector[3].iov_len = size - ofs;
ofs += req->in.vector[3].iov_len;
diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c
index d727ee98b0..c33d1c61be 100644
--- a/source3/smbd/smb2_sesssetup.c
+++ b/source3/smbd/smb2_sesssetup.c
@@ -844,7 +844,7 @@ NTSTATUS smbd_smb2_request_check_session(struct smbd_smb2_request *req)
if (chained_fixup) {
/* Fix up our own outhdr. */
outhdr = (const uint8_t *)req->out.vector[i].iov_base;
- SBVAL(outhdr, SMB2_HDR_SESSION_ID, in_session_id);
+ SBVAL(discard_const_p(uint8_t, outhdr), SMB2_HDR_SESSION_ID, in_session_id);
}
return NT_STATUS_OK;
}
diff --git a/source3/smbd/smb2_tcon.c b/source3/smbd/smb2_tcon.c
index bdd18d5d07..1b4aa79070 100644
--- a/source3/smbd/smb2_tcon.c
+++ b/source3/smbd/smb2_tcon.c
@@ -331,7 +331,7 @@ NTSTATUS smbd_smb2_request_check_tcon(struct smbd_smb2_request *req)
if (chained_fixup) {
/* Fix up our own outhdr. */
outhdr = (const uint8_t *)req->out.vector[i].iov_base;
- SIVAL(outhdr, SMB2_HDR_TID, in_tid);
+ SIVAL(discard_const_p(uint8_t, outhdr), SMB2_HDR_TID, in_tid);
}
return NT_STATUS_OK;