summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/groupdb/mapping_tdb.c24
-rw-r--r--source3/include/util_tdb.h7
-rw-r--r--source3/lib/gencache.c6
-rw-r--r--source3/lib/ldb/ldb_tdb/ldb_pack.c2
-rw-r--r--source3/lib/ldb/ldb_tdb/ldb_tdb.c2
-rw-r--r--source3/lib/messages.c12
-rw-r--r--source3/lib/privileges.c6
-rw-r--r--source3/lib/util_tdb.c30
-rw-r--r--source3/libsmb/samlogon_cache.c4
-rw-r--r--source3/libsmb/smb_share_modes.c14
-rw-r--r--source3/libsmb/unexpected.c6
-rw-r--r--source3/locking/brlock.c8
-rw-r--r--source3/locking/locking.c20
-rw-r--r--source3/locking/posix.c8
-rw-r--r--source3/nmbd/nmbd_winsserver.c6
-rw-r--r--source3/nsswitch/idmap_cache.c8
-rw-r--r--source3/nsswitch/idmap_tdb.c51
-rw-r--r--source3/nsswitch/winbindd_cache.c24
-rw-r--r--source3/passdb/login_cache.c2
-rw-r--r--source3/passdb/passdb.c4
-rw-r--r--source3/passdb/pdb_tdb.c23
-rw-r--r--source3/passdb/secrets.c26
-rw-r--r--source3/printing/notify.c6
-rw-r--r--source3/printing/nt_printing.c55
-rw-r--r--source3/printing/printing.c34
-rw-r--r--source3/registry/reg_db.c14
-rw-r--r--source3/registry/reg_perfcount.c2
-rw-r--r--source3/rpc_parse/parse_prs.c4
-rw-r--r--source3/rpc_server/srv_eventlog_lib.c10
-rw-r--r--source3/rpc_server/srv_eventlog_nt.c2
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c8
-rw-r--r--source3/smbd/connection.c6
-rw-r--r--source3/smbd/mangle_hash.c2
-rw-r--r--source3/smbd/notify_internal.c2
-rw-r--r--source3/smbd/session.c2
-rw-r--r--source3/smbd/statcache.c6
-rw-r--r--source3/tdb/common/freelistcheck.c2
-rw-r--r--source3/tdb/common/io.c8
-rw-r--r--source3/tdb/common/tdb.c6
-rw-r--r--source3/tdb/common/tdb_private.h2
-rw-r--r--source3/tdb/common/traverse.c2
-rw-r--r--source3/tdb/include/tdb.h2
-rw-r--r--source3/tdb/tools/tdbdump.c2
-rw-r--r--source3/tdb/tools/tdbtool.c22
-rw-r--r--source3/torture/mangle_test.c4
-rw-r--r--source3/utils/smbcontrol.c2
46 files changed, 251 insertions, 247 deletions
diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c
index 1d7eaa98d8..255ac9a5e5 100644
--- a/source3/groupdb/mapping_tdb.c
+++ b/source3/groupdb/mapping_tdb.c
@@ -99,7 +99,7 @@ static TDB_CONTEXT *tdb; /* used for driver files */
sid_to_string(string_sid, &map->sid);
- len = tdb_pack(buf, sizeof(buf), "ddff",
+ len = tdb_pack((uint8 *)buf, sizeof(buf), "ddff",
map->gid, map->sid_name_use, map->nt_name, map->comment);
if (len > sizeof(buf))
@@ -108,7 +108,7 @@ static TDB_CONTEXT *tdb; /* used for driver files */
slprintf(key, sizeof(key), "%s%s", GROUP_PREFIX, string_sid);
dbuf.dsize = len;
- dbuf.dptr = buf;
+ dbuf.dptr = (uint8 *)buf;
if (tdb_store_bystring(tdb, key, dbuf, flag) != 0) return False;
return True;
@@ -176,13 +176,13 @@ static TDB_CONTEXT *tdb; /* used for driver files */
kbuf.dptr;
newkey = tdb_nextkey(tdb, kbuf), safe_free(kbuf.dptr), kbuf=newkey) {
- if (strncmp(kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0) continue;
+ if (strncmp((const char *)kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0) continue;
dbuf = tdb_fetch(tdb, kbuf);
if (!dbuf.dptr)
continue;
- fstrcpy(string_sid, kbuf.dptr+strlen(GROUP_PREFIX));
+ fstrcpy(string_sid, (const char *)kbuf.dptr+strlen(GROUP_PREFIX));
string_to_sid(&map->sid, string_sid);
@@ -226,13 +226,13 @@ static TDB_CONTEXT *tdb; /* used for driver files */
kbuf.dptr;
newkey = tdb_nextkey(tdb, kbuf), safe_free(kbuf.dptr), kbuf=newkey) {
- if (strncmp(kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0) continue;
+ if (strncmp((const char *)kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0) continue;
dbuf = tdb_fetch(tdb, kbuf);
if (!dbuf.dptr)
continue;
- fstrcpy(string_sid, kbuf.dptr+strlen(GROUP_PREFIX));
+ fstrcpy(string_sid, (const char *)kbuf.dptr+strlen(GROUP_PREFIX));
string_to_sid(&map->sid, string_sid);
@@ -315,14 +315,14 @@ BOOL enum_group_mapping(const DOM_SID *domsid, enum lsa_SidType sid_name_use, GR
kbuf.dptr;
newkey = tdb_nextkey(tdb, kbuf), safe_free(kbuf.dptr), kbuf=newkey) {
- if (strncmp(kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0)
+ if (strncmp((const char *)kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0)
continue;
dbuf = tdb_fetch(tdb, kbuf);
if (!dbuf.dptr)
continue;
- fstrcpy(string_sid, kbuf.dptr+strlen(GROUP_PREFIX));
+ fstrcpy(string_sid, (const char *)kbuf.dptr+strlen(GROUP_PREFIX));
ret = tdb_unpack(dbuf.dptr, dbuf.dsize, "ddff",
&map.gid, &map.sid_name_use, &map.nt_name, &map.comment);
@@ -409,7 +409,7 @@ BOOL enum_group_mapping(const DOM_SID *domsid, enum lsa_SidType sid_name_use, GR
return NT_STATUS_OK;
}
- p = dbuf.dptr;
+ p = (const char *)dbuf.dptr;
while (next_token(&p, string_sid, " ", sizeof(string_sid))) {
@@ -528,11 +528,11 @@ static int collect_aliasmem(TDB_CONTEXT *tdb_ctx, TDB_DATA key, TDB_DATA data,
const char *p;
fstring alias_string;
- if (strncmp(key.dptr, MEMBEROF_PREFIX,
+ if (strncmp((const char *)key.dptr, MEMBEROF_PREFIX,
strlen(MEMBEROF_PREFIX)) != 0)
return 0;
- p = data.dptr;
+ p = (const char *)data.dptr;
while (next_token(&p, alias_string, " ", sizeof(alias_string))) {
@@ -550,7 +550,7 @@ static int collect_aliasmem(TDB_CONTEXT *tdb_ctx, TDB_DATA key, TDB_DATA data,
* list currently scanned. The key represents the alias
* member. Add that. */
- member_string = strchr(key.dptr, '/');
+ member_string = strchr((const char *)key.dptr, '/');
/* Above we tested for MEMBEROF_PREFIX which includes the
* slash. */
diff --git a/source3/include/util_tdb.h b/source3/include/util_tdb.h
index a8def46e44..bdf11d59ee 100644
--- a/source3/include/util_tdb.h
+++ b/source3/include/util_tdb.h
@@ -62,10 +62,11 @@ TDB_DATA tdb_fetch_bystring(struct tdb_context *tdb, const char *keystr);
int tdb_delete_bystring(struct tdb_context *tdb, const char *keystr);
struct tdb_context *tdb_open_log(const char *name, int hash_size,
int tdb_flags, int open_flags, mode_t mode);
-int tdb_unpack(char *buf, int bufsize, const char *fmt, ...);
-size_t tdb_pack(char *buf, int bufsize, const char *fmt, ...);
-TDB_DATA make_tdb_data(const char *dptr, size_t dsize);
+int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...);
+size_t tdb_pack(uint8 *buf, int bufsize, const char *fmt, ...);
+TDB_DATA make_tdb_data(const uint8 *dptr, size_t dsize);
TDB_DATA string_tdb_data(const char *string);
+TDB_DATA string_term_tdb_data(const char *string);
int tdb_trans_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf,
int flag);
int tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr,
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index d6f5584c12..af60ee1ff4 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -205,7 +205,7 @@ BOOL gencache_get(const char *keystr, char **valstr, time_t *timeout)
return False;
}
- t = strtol(databuf.dptr, &endptr, 10);
+ t = strtol((const char *)databuf.dptr, &endptr, 10);
if ((endptr == NULL) || (*endptr != '/')) {
DEBUG(2, ("Invalid gencache data format: %s\n", databuf.dptr));
@@ -279,7 +279,7 @@ void gencache_iterate(void (*fn)(const char* key, const char *value, time_t time
char *fmt;
/* ensure null termination of the key string */
- keystr = SMB_STRNDUP(node->node_key.dptr, node->node_key.dsize);
+ keystr = SMB_STRNDUP((const char *)node->node_key.dptr, node->node_key.dsize);
if (!keystr) {
break;
}
@@ -295,7 +295,7 @@ void gencache_iterate(void (*fn)(const char* key, const char *value, time_t time
node = node->next;
continue;
}
- entry = SMB_STRNDUP(databuf.dptr, databuf.dsize);
+ entry = SMB_STRNDUP((const char *)databuf.dptr, databuf.dsize);
if (!entry) {
SAFE_FREE(databuf.dptr);
SAFE_FREE(keystr);
diff --git a/source3/lib/ldb/ldb_tdb/ldb_pack.c b/source3/lib/ldb/ldb_tdb/ldb_pack.c
index 50dc20524f..45fcf354a5 100644
--- a/source3/lib/ldb/ldb_tdb/ldb_pack.c
+++ b/source3/lib/ldb/ldb_tdb/ldb_pack.c
@@ -114,7 +114,7 @@ int ltdb_pack_data(struct ldb_module *module,
}
/* allocate it */
- data->dptr = talloc_array(ldb, char, size);
+ data->dptr = talloc_array(ldb, uint8_t, size);
if (!data->dptr) {
talloc_free(dn);
errno = ENOMEM;
diff --git a/source3/lib/ldb/ldb_tdb/ldb_tdb.c b/source3/lib/ldb/ldb_tdb/ldb_tdb.c
index 34daba69bf..fead100f72 100644
--- a/source3/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source3/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -151,7 +151,7 @@ struct TDB_DATA ltdb_key(struct ldb_module *module, const struct ldb_dn *dn)
goto failed;
}
- key.dptr = (char *)key_str;
+ key.dptr = (uint8_t *)key_str;
key.dsize = strlen(key_str) + 1;
return key;
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index e2c8a6b52f..336a9349e6 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -159,7 +159,7 @@ static TDB_DATA message_key_pid(struct process_id pid)
slprintf(key, sizeof(key)-1, "PID/%s", procid_str_static(&pid));
- kbuf.dptr = (char *)key;
+ kbuf.dptr = (uint8 *)key;
kbuf.dsize = strlen(key)+1;
return kbuf;
}
@@ -233,7 +233,7 @@ static NTSTATUS message_send_pid_internal(struct process_id pid, int msg_type,
TDB_DATA dbuf;
TDB_DATA old_dbuf;
struct message_rec rec;
- char *ptr;
+ uint8 *ptr;
struct message_rec prec;
/* NULL pointer means implicit length zero. */
@@ -256,7 +256,7 @@ static NTSTATUS message_send_pid_internal(struct process_id pid, int msg_type,
kbuf = message_key_pid(pid);
- dbuf.dptr = (char *)SMB_MALLOC(len + sizeof(rec));
+ dbuf.dptr = (uint8 *)SMB_MALLOC(len + sizeof(rec));
if (!dbuf.dptr) {
return NT_STATUS_NO_MEMORY;
}
@@ -323,7 +323,7 @@ static NTSTATUS message_send_pid_internal(struct process_id pid, int msg_type,
/* Not a new record. Check for duplicates. */
- for(ptr = (char *)old_dbuf.dptr; ptr < old_dbuf.dptr + old_dbuf.dsize; ) {
+ for(ptr = old_dbuf.dptr; ptr < old_dbuf.dptr + old_dbuf.dsize; ) {
/*
* First check if the message header matches, then, if it's a non-zero
* sized message, check if the data matches. If so it's a duplicate and
@@ -387,7 +387,7 @@ unsigned int messages_pending_for_pid(struct process_id pid)
{
TDB_DATA kbuf;
TDB_DATA dbuf;
- char *buf;
+ uint8 *buf;
unsigned int message_count = 0;
kbuf = message_key_pid(pid);
@@ -443,7 +443,7 @@ static BOOL retrieve_all_messages(char **msgs_buf, size_t *total_len)
return False;
}
- *msgs_buf = dbuf.dptr;
+ *msgs_buf = (char *)dbuf.dptr;
*total_len = dbuf.dsize;
return True;
diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c
index 2348995dc8..5fa9fd7a7d 100644
--- a/source3/lib/privileges.c
+++ b/source3/lib/privileges.c
@@ -295,7 +295,7 @@ static BOOL set_privileges( const DOM_SID *sid, SE_PRIV *mask )
/* no packing. static size structure, just write it out */
- data.dptr = (char*)mask;
+ data.dptr = (uint8 *)mask;
data.dsize = sizeof(SE_PRIV);
return ( tdb_store_bystring(tdb, keystr, data, TDB_REPLACE) != -1 );
@@ -482,7 +482,7 @@ static int priv_traverse_fn(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *s
/* check we have a PRIV_+SID entry */
- if ( strncmp(key.dptr, PRIVPREFIX, prefixlen) != 0)
+ if ( strncmp((const char *)key.dptr, PRIVPREFIX, prefixlen) != 0)
return 0;
/* check to see if we are looking for a particular privilege */
@@ -499,7 +499,7 @@ static int priv_traverse_fn(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void *s
return 0;
}
- fstrcpy( sid_string, &key.dptr[strlen(PRIVPREFIX)] );
+ fstrcpy( sid_string, (const char *)&key.dptr[strlen(PRIVPREFIX)] );
/* this is a last ditch safety check to preventing returning
and invalid SID (i've somehow run into this on development branches) */
diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c
index 5f96580120..c6e3063d56 100644
--- a/source3/lib/util_tdb.c
+++ b/source3/lib/util_tdb.c
@@ -43,22 +43,22 @@ static void gotalarm_sig(void)
Make a TDB_DATA and keep the const warning in one place
****************************************************************/
-TDB_DATA make_tdb_data(const char *dptr, size_t dsize)
+TDB_DATA make_tdb_data(const uint8 *dptr, size_t dsize)
{
TDB_DATA ret;
- ret.dptr = CONST_DISCARD(char *, dptr);
+ ret.dptr = CONST_DISCARD(uint8 *, dptr);
ret.dsize = dsize;
return ret;
}
TDB_DATA string_tdb_data(const char *string)
{
- return make_tdb_data(string, string ? strlen(string) : 0 );
+ return make_tdb_data((const uint8 *)string, string ? strlen(string) : 0 );
}
TDB_DATA string_term_tdb_data(const char *string)
{
- return make_tdb_data(string, string ? strlen(string) + 1 : 0);
+ return make_tdb_data((const uint8 *)string, string ? strlen(string) + 1 : 0);
}
/****************************************************************************
@@ -204,7 +204,7 @@ int tdb_store_int32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, int32 v)
int32 v_store;
SIVAL(&v_store,0,v);
- data.dptr = (char *)&v_store;
+ data.dptr = (uint8 *)&v_store;
data.dsize = sizeof(int32);
return tdb_store(tdb, key, data, TDB_REPLACE);
@@ -266,7 +266,7 @@ BOOL tdb_store_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 value)
BOOL ret = True;
SIVAL(&v_store, 0, value);
- data.dptr = (char *)&v_store;
+ data.dptr = (uint8 *)&v_store;
data.dsize = sizeof(uint32);
if (tdb_store(tdb, key, data, TDB_REPLACE) == -1)
@@ -417,7 +417,7 @@ BOOL tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr, uint32 *oldv
integers and strings.
****************************************************************************/
-size_t tdb_pack_va(char *buf, int bufsize, const char *fmt, va_list ap)
+size_t tdb_pack_va(uint8 *buf, int bufsize, const char *fmt, va_list ap)
{
uint8 bt;
uint16 w;
@@ -427,7 +427,7 @@ size_t tdb_pack_va(char *buf, int bufsize, const char *fmt, va_list ap)
int len;
char *s;
char c;
- char *buf0 = buf;
+ uint8 *buf0 = buf;
const char *fmt0 = fmt;
int bufsize0 = bufsize;
@@ -501,7 +501,7 @@ size_t tdb_pack_va(char *buf, int bufsize, const char *fmt, va_list ap)
return PTR_DIFF(buf, buf0);
}
-size_t tdb_pack(char *buf, int bufsize, const char *fmt, ...)
+size_t tdb_pack(uint8 *buf, int bufsize, const char *fmt, ...)
{
va_list ap;
size_t result;
@@ -534,7 +534,7 @@ BOOL tdb_pack_append(TALLOC_CTX *mem_ctx, uint8 **buf, size_t *len,
}
va_start(ap, fmt);
- len2 = tdb_pack_va((char *)(*buf)+(*len), len1, fmt, ap);
+ len2 = tdb_pack_va((*buf)+(*len), len1, fmt, ap);
va_end(ap);
if (len1 != len2) {
@@ -551,7 +551,7 @@ BOOL tdb_pack_append(TALLOC_CTX *mem_ctx, uint8 **buf, size_t *len,
integers and strings.
****************************************************************************/
-int tdb_unpack(char *buf, int bufsize, const char *fmt, ...)
+int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...)
{
va_list ap;
uint8 *bt;
@@ -562,7 +562,7 @@ int tdb_unpack(char *buf, int bufsize, const char *fmt, ...)
void **p;
char *s, **b;
char c;
- char *buf0 = buf;
+ const uint8 *buf0 = buf;
const char *fmt0 = fmt;
int bufsize0 = bufsize;
@@ -605,14 +605,14 @@ int tdb_unpack(char *buf, int bufsize, const char *fmt, ...)
break;
case 'P':
s = va_arg(ap,char *);
- len = strlen(buf) + 1;
+ len = strlen((const char *)buf) + 1;
if (bufsize < len || len > sizeof(pstring))
goto no_space;
memcpy(s, buf, len);
break;
case 'f':
s = va_arg(ap,char *);
- len = strlen(buf) + 1;
+ len = strlen((const char *)buf) + 1;
if (bufsize < len || len > sizeof(fstring))
goto no_space;
memcpy(s, buf, len);
@@ -734,7 +734,7 @@ TDB_LIST_NODE *tdb_search_keys(TDB_CONTEXT *tdb, const char* pattern)
for (key = tdb_firstkey(tdb); key.dptr; key = next) {
/* duplicate key string to ensure null-termination */
- char *key_str = SMB_STRNDUP(key.dptr, key.dsize);
+ char *key_str = SMB_STRNDUP((const char *)key.dptr, key.dsize);
if (!key_str) {
DEBUG(0, ("tdb_search_keys: strndup() failed!\n"));
smb_panic("strndup failed!\n");
diff --git a/source3/libsmb/samlogon_cache.c b/source3/libsmb/samlogon_cache.c
index e82ee8dbb8..61dddb62fd 100644
--- a/source3/libsmb/samlogon_cache.c
+++ b/source3/libsmb/samlogon_cache.c
@@ -156,7 +156,7 @@ BOOL netsamlogon_cache_store( const char *username, NET_USER_INFO_3 *user )
if ( net_io_user_info3("", user, &ps, 0, 3, 0) )
{
data.dsize = prs_offset( &ps );
- data.dptr = prs_data_p( &ps );
+ data.dptr = (uint8 *)prs_data_p( &ps );
if (tdb_store_bystring(netsamlogon_tdb, keystr, data, TDB_REPLACE) != -1)
result = True;
@@ -198,7 +198,7 @@ NET_USER_INFO_3* netsamlogon_cache_get( TALLOC_CTX *mem_ctx, const DOM_SID *user
return NULL;
prs_init( &ps, 0, mem_ctx, UNMARSHALL );
- prs_give_memory( &ps, data.dptr, data.dsize, True );
+ prs_give_memory( &ps, (char *)data.dptr, data.dsize, True );
if ( !prs_uint32( "timestamp", &ps, 0, &t ) ) {
prs_mem_free( &ps );
diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c
index 4c49ecb7bd..e98de5e264 100644
--- a/source3/libsmb/smb_share_modes.c
+++ b/source3/libsmb/smb_share_modes.c
@@ -96,7 +96,7 @@ static TDB_DATA get_locking_key(uint64_t dev, uint64_t ino)
memset(&lk, '\0', sizeof(struct locking_key));
lk.dev = (SMB_DEV_T)dev;
lk.inode = (SMB_INO_T)ino;
- ld.dptr = (char *)&lk;
+ ld.dptr = (uint8 *)&lk;
ld.dsize = sizeof(lk);
return ld;
}
@@ -258,13 +258,13 @@ int smb_create_share_mode_entry_ex(struct smbdb_ctx *db_ctx,
int orig_num_share_modes = 0;
struct locking_data *ld = NULL; /* internal samba db state. */
struct share_mode_entry *shares = NULL;
- char *new_data_p = NULL;
+ uint8 *new_data_p = NULL;
size_t new_data_size = 0;
db_data = tdb_fetch(db_ctx->smb_tdb, locking_key);
if (!db_data.dptr) {
/* We must create the entry. */
- db_data.dptr = (char *)malloc(
+ db_data.dptr = (uint8 *)malloc(
(2*sizeof(struct share_mode_entry)) +
strlen(sharepath) + 1 +
strlen(filename) + 1);
@@ -299,7 +299,7 @@ int smb_create_share_mode_entry_ex(struct smbdb_ctx *db_ctx,
}
/* Entry exists, we must add a new entry. */
- new_data_p = (char *)malloc(
+ new_data_p = (uint8 *)malloc(
db_data.dsize + sizeof(struct share_mode_entry));
if (!new_data_p) {
free(db_data.dptr);
@@ -370,10 +370,10 @@ int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx,
int orig_num_share_modes = 0;
struct locking_data *ld = NULL; /* internal samba db state. */
struct share_mode_entry *shares = NULL;
- char *new_data_p = NULL;
+ uint8 *new_data_p = NULL;
size_t remaining_size = 0;
size_t i, num_share_modes;
- const char *remaining_ptr = NULL;
+ const uint8 *remaining_ptr = NULL;
db_data = tdb_fetch(db_ctx->smb_tdb, locking_key);
if (!db_data.dptr) {
@@ -397,7 +397,7 @@ int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx,
}
/* More than one - allocate a new record minus the one we'll delete. */
- new_data_p = (char *)malloc(
+ new_data_p = (uint8 *)malloc(
db_data.dsize - sizeof(struct share_mode_entry));
if (!new_data_p) {
free(db_data.dptr);
diff --git a/source3/libsmb/unexpected.c b/source3/libsmb/unexpected.c
index 97d6071e71..5aee16e4c6 100644
--- a/source3/libsmb/unexpected.c
+++ b/source3/libsmb/unexpected.c
@@ -63,9 +63,9 @@ void unexpected_packet(struct packet_struct *p)
key.timestamp = p->timestamp;
key.count = count++;
- kbuf.dptr = (char *)&key;
+ kbuf.dptr = (uint8_t *)&key;
kbuf.dsize = sizeof(key);
- dbuf.dptr = buf;
+ dbuf.dptr = (uint8_t *)buf;
dbuf.dsize = len;
tdb_store(tdbd, kbuf, dbuf, TDB_REPLACE);
@@ -124,7 +124,7 @@ static int traverse_match(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf, void
if (key.packet_type != match_type) return 0;
- p = parse_packet(dbuf.dptr, dbuf.dsize, match_type);
+ p = parse_packet((char *)dbuf.dptr, dbuf.dsize, match_type);
if ((match_type == NMB_PACKET &&
p->packet.nmb.header.name_trn_id == match_id) ||
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 76a4039d82..899e211ffc 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -1453,7 +1453,7 @@ static int traverse_fn(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf, void *st
}
if (orig_num_locks != num_locks) {
- dbuf.dptr = (char *)locks;
+ dbuf.dptr = (uint8 *)locks;
dbuf.dsize = num_locks * sizeof(*locks);
if (dbuf.dsize) {
@@ -1499,7 +1499,7 @@ static int byte_range_lock_destructor(struct byte_range_lock *br_lck)
{
TDB_DATA key;
- key.dptr = (char *)&br_lck->key;
+ key.dptr = (uint8 *)&br_lck->key;
key.dsize = sizeof(struct lock_key);
if (br_lck->read_only) {
@@ -1517,7 +1517,7 @@ static int byte_range_lock_destructor(struct byte_range_lock *br_lck)
}
} else {
TDB_DATA data;
- data.dptr = (char *)br_lck->lock_data;
+ data.dptr = (uint8 *)br_lck->lock_data;
data.dsize = br_lck->num_locks * sizeof(struct lock_struct);
if (tdb_store(tdb, key, data, TDB_REPLACE) == -1) {
@@ -1558,7 +1558,7 @@ static struct byte_range_lock *brl_get_locks_internal(TALLOC_CTX *mem_ctx,
br_lck->key.device = fsp->dev;
br_lck->key.inode = fsp->inode;
- key.dptr = (char *)&br_lck->key;
+ key.dptr = (uint8 *)&br_lck->key;
key.dsize = sizeof(struct lock_key);
if (!fsp->lockdb_clean) {
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 37e6dbc4e5..dc1d607155 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -433,7 +433,7 @@ static TDB_DATA locking_key(SMB_DEV_T dev, SMB_INO_T inode)
memset(&key, '\0', sizeof(key));
key.dev = dev;
key.ino = inode;
- kbuf.dptr = (char *)&key;
+ kbuf.dptr = (uint8 *)&key;
kbuf.dsize = sizeof(key);
return kbuf;
}
@@ -532,7 +532,7 @@ static BOOL parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck)
/* Get any delete token. */
if (data->u.s.delete_token_size) {
- char *p = dbuf.dptr + sizeof(*data) +
+ uint8 *p = dbuf.dptr + sizeof(*data) +
(lck->num_share_modes *
sizeof(struct share_mode_entry));
@@ -578,7 +578,7 @@ static BOOL parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck)
}
/* Save off the associated service path and filename. */
- lck->servicepath = talloc_strdup(lck, dbuf.dptr + sizeof(*data) +
+ lck->servicepath = talloc_strdup(lck, (const char *)dbuf.dptr + sizeof(*data) +
(lck->num_share_modes *
sizeof(struct share_mode_entry)) +
data->u.s.delete_token_size );
@@ -586,7 +586,7 @@ static BOOL parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck)
smb_panic("talloc_strdup failed\n");
}
- lck->filename = talloc_strdup(lck, dbuf.dptr + sizeof(*data) +
+ lck->filename = talloc_strdup(lck, (const char *)dbuf.dptr + sizeof(*data) +
(lck->num_share_modes *
sizeof(struct share_mode_entry)) +
data->u.s.delete_token_size +
@@ -646,7 +646,7 @@ static TDB_DATA unparse_share_modes(struct share_mode_lock *lck)
delete_token_size +
sp_len + 1 +
strlen(lck->filename) + 1;
- result.dptr = TALLOC_ARRAY(lck, char, result.dsize);
+ result.dptr = TALLOC_ARRAY(lck, uint8, result.dsize);
if (result.dptr == NULL) {
smb_panic("talloc failed\n");
@@ -668,7 +668,7 @@ static TDB_DATA unparse_share_modes(struct share_mode_lock *lck)
/* Store any delete on close token. */
if (lck->delete_token) {
- char *p = result.dptr + offset;
+ uint8 *p = result.dptr + offset;
memcpy(p, &lck->delete_token->uid, sizeof(uid_t));
p += sizeof(uid_t);
@@ -683,10 +683,10 @@ static TDB_DATA unparse_share_modes(struct share_mode_lock *lck)
offset = p - result.dptr;
}
- safe_strcpy(result.dptr + offset, lck->servicepath,
+ safe_strcpy((char *)result.dptr + offset, lck->servicepath,
result.dsize - offset - 1);
offset += sp_len + 1;
- safe_strcpy(result.dptr + offset, lck->filename,
+ safe_strcpy((char *)result.dptr + offset, lck->filename,
result.dsize - offset - 1);
if (DEBUGLEVEL >= 10) {
@@ -1318,10 +1318,10 @@ static int traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf,
data = (struct locking_data *)dbuf.dptr;
shares = (struct share_mode_entry *)(dbuf.dptr + sizeof(*data));
- sharepath = dbuf.dptr + sizeof(*data) +
+ sharepath = (const char *)dbuf.dptr + sizeof(*data) +
data->u.s.num_share_mode_entries*sizeof(*shares) +
data->u.s.delete_token_size;
- fname = dbuf.dptr + sizeof(*data) +
+ fname = (const char *)dbuf.dptr + sizeof(*data) +
data->u.s.num_share_mode_entries*sizeof(*shares) +
data->u.s.delete_token_size +
strlen(sharepath) + 1;
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 62804eb8e3..8bb7f605e3 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -340,7 +340,7 @@ static TDB_DATA fd_array_key(SMB_DEV_T dev, SMB_INO_T inode)
memset(&key, '\0', sizeof(key));
key.device = dev;
key.inode = inode;
- kbuf.dptr = (char *)&key;
+ kbuf.dptr = (uint8 *)&key;
kbuf.dsize = sizeof(key);
return kbuf;
}
@@ -358,7 +358,7 @@ static TDB_DATA locking_ref_count_key(SMB_DEV_T dev, SMB_INO_T inode)
key.device = dev;
key.inode = inode;
key.r = 'r';
- kbuf.dptr = (char *)&key;
+ kbuf.dptr = (uint8 *)&key;
kbuf.dsize = sizeof(key);
return kbuf;
}
@@ -442,7 +442,7 @@ static void increment_windows_lock_ref_count(files_struct *fsp)
dbuf = tdb_fetch(posix_pending_close_tdb, kbuf);
if (dbuf.dptr == NULL) {
- dbuf.dptr = (char *)SMB_MALLOC_P(int);
+ dbuf.dptr = (uint8 *)SMB_MALLOC_P(int);
if (!dbuf.dptr) {
smb_panic("increment_windows_lock_ref_count: malloc fail.\n");
}
@@ -573,7 +573,7 @@ static void add_fd_to_close_entry(files_struct *fsp)
dbuf = tdb_fetch(posix_pending_close_tdb, kbuf);
- dbuf.dptr = (char *)SMB_REALLOC(dbuf.dptr, dbuf.dsize + sizeof(int));
+ dbuf.dptr = (uint8 *)SMB_REALLOC(dbuf.dptr, dbuf.dsize + sizeof(int));
if (!dbuf.dptr) {
smb_panic("add_fd_to_close_entry: Realloc fail !\n");
}
diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c
index 6ea102c391..9c2fe72702 100644
--- a/source3/nmbd/nmbd_winsserver.c
+++ b/source3/nmbd/nmbd_winsserver.c
@@ -103,7 +103,7 @@ static struct name_record *wins_record_to_name_record(TDB_DATA key, TDB_DATA dat
}
namerec->subnet = wins_server_subnet;
- push_ascii_nstring(namerec->name.name, key.dptr);
+ push_ascii_nstring(namerec->name.name, (const char *)key.dptr);
namerec->name.name_type = key.dptr[sizeof(unstring)];
/* Add the scope. */
push_ascii(namerec->name.scope, global_scope(), 64, STR_TERMINATE);
@@ -159,7 +159,7 @@ static TDB_DATA name_record_to_wins_record(const struct name_record *namerec)
len = (2 + 1 + (7*4)); /* "wbddddddd" */
len += (namerec->data.num_ips * 4);
- data.dptr = (char *)SMB_MALLOC(len);
+ data.dptr = (uint8 *)SMB_MALLOC(len);
if (!data.dptr) {
return data;
}
@@ -197,7 +197,7 @@ static TDB_DATA name_to_key(const struct nmb_name *nmbname)
pull_ascii_nstring(keydata, sizeof(unstring), nmbname->name);
strupper_m(keydata);
keydata[sizeof(unstring)] = nmbname->name_type;
- key.dptr = keydata;
+ key.dptr = (uint8 *)keydata;
key.dsize = sizeof(keydata);
return key;
diff --git a/source3/nsswitch/idmap_cache.c b/source3/nsswitch/idmap_cache.c
index cc42ef098e..6d23e75b2c 100644
--- a/source3/nsswitch/idmap_cache.c
+++ b/source3/nsswitch/idmap_cache.c
@@ -370,10 +370,10 @@ NTSTATUS idmap_cache_map_sid(struct idmap_cache_ctx *cache, struct id_map *id)
return NT_STATUS_NONE_MAPPED;
}
- t = strtol(databuf.dptr, &endptr, 10);
+ t = strtol((const char *)databuf.dptr, &endptr, 10);
if ((endptr == NULL) || (*endptr != '/')) {
- DEBUG(2, ("Invalid gencache data format: %s\n", databuf.dptr));
+ DEBUG(2, ("Invalid gencache data format: %s\n", (const char *)databuf.dptr));
/* remove the entry */
tdb_delete_bystring(cache->tdb, sidkey);
ret = NT_STATUS_NONE_MAPPED;
@@ -477,10 +477,10 @@ NTSTATUS idmap_cache_map_id(struct idmap_cache_ctx *cache, struct id_map *id)
return NT_STATUS_NONE_MAPPED;
}
- t = strtol(databuf.dptr, &endptr, 10);
+ t = strtol((const char *)databuf.dptr, &endptr, 10);
if ((endptr == NULL) || (*endptr != '/')) {
- DEBUG(2, ("Invalid gencache data format: %s\n", databuf.dptr));
+ DEBUG(2, ("Invalid gencache data format: %s\n", (const char *)databuf.dptr));
/* remove the entry */
tdb_delete_bystring(cache->tdb, idkey);
ret = NT_STATUS_NONE_MAPPED;
diff --git a/source3/nsswitch/idmap_tdb.c b/source3/nsswitch/idmap_tdb.c
index 764cfc365d..6aff754946 100644
--- a/source3/nsswitch/idmap_tdb.c
+++ b/source3/nsswitch/idmap_tdb.c
@@ -57,24 +57,24 @@ static int convert_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA data, void *state
TDB_DATA key2;
BOOL *failed = (BOOL *)state;
- DEBUG(10,("Converting %s\n", key.dptr));
+ DEBUG(10,("Converting %s\n", (const char *)key.dptr));
- p = strchr(key.dptr, '/');
+ p = strchr((const char *)key.dptr, '/');
if (!p)
return 0;
*p = 0;
- fstrcpy(dom_name, key.dptr);
+ fstrcpy(dom_name, (const char *)key.dptr);
*p++ = '/';
domain = find_domain_from_name(dom_name);
if (domain == NULL) {
/* We must delete the old record. */
DEBUG(0,("Unable to find domain %s\n", dom_name ));
- DEBUG(0,("deleting record %s\n", key.dptr ));
+ DEBUG(0,("deleting record %s\n", (const char *)key.dptr ));
if (tdb_delete(tdb, key) != 0) {
- DEBUG(0, ("Unable to delete record %s\n", key.dptr));
+ DEBUG(0, ("Unable to delete record %s\n", (const char *)key.dptr));
*failed = True;
return -1;
}
@@ -91,19 +91,19 @@ static int convert_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA data, void *state
key2 = string_term_tdb_data(keystr);
if (tdb_store(tdb, key2, data, TDB_INSERT) != 0) {
- DEBUG(0,("Unable to add record %s\n", key2.dptr ));
+ DEBUG(0,("Unable to add record %s\n", (const char *)key2.dptr ));
*failed = True;
return -1;
}
if (tdb_store(tdb, data, key2, TDB_REPLACE) != 0) {
- DEBUG(0,("Unable to update record %s\n", data.dptr ));
+ DEBUG(0,("Unable to update record %s\n", (const char *)data.dptr ));
*failed = True;
return -1;
}
if (tdb_delete(tdb, key) != 0) {
- DEBUG(0,("Unable to delete record %s\n", key.dptr ));
+ DEBUG(0,("Unable to delete record %s\n", (const char *)key.dptr ));
*failed = True;
return -1;
}
@@ -710,14 +710,14 @@ static NTSTATUS idmap_tdb_id_to_sid(struct idmap_tdb_context *ctx, struct id_map
goto done;
}
- if (!string_to_sid(map->sid, data.dptr)) {
+ if (!string_to_sid(map->sid, (const char *)data.dptr)) {
DEBUG(10,("INVALID SID (%s) in record %s\n",
- data.dptr, keystr));
+ (const char *)data.dptr, keystr));
ret = NT_STATUS_INTERNAL_DB_ERROR;
goto done;
}
- DEBUG(10,("Found record %s -> %s\n", keystr, data.dptr));
+ DEBUG(10,("Found record %s -> %s\n", keystr, (const char *)data.dptr));
ret = NT_STATUS_OK;
done:
@@ -754,20 +754,20 @@ static NTSTATUS idmap_tdb_sid_to_id(struct idmap_tdb_context *ctx, struct id_map
}
/* What type of record is this ? */
- if (sscanf(data.dptr, "UID %lu", &rec_id) == 1) { /* Try a UID record. */
+ if (sscanf((const char *)data.dptr, "UID %lu", &rec_id) == 1) { /* Try a UID record. */
map->xid.id = rec_id;
map->xid.type = ID_TYPE_UID;
- DEBUG(10,("Found uid record %s -> %s \n", keystr, data.dptr ));
+ DEBUG(10,("Found uid record %s -> %s \n", keystr, (const char *)data.dptr ));
ret = NT_STATUS_OK;
- } else if (sscanf(data.dptr, "GID %lu", &rec_id) == 1) { /* Try a GID record. */
+ } else if (sscanf((const char *)data.dptr, "GID %lu", &rec_id) == 1) { /* Try a GID record. */
map->xid.id = rec_id;
map->xid.type = ID_TYPE_GID;
- DEBUG(10,("Found gid record %s -> %s \n", keystr, data.dptr ));
+ DEBUG(10,("Found gid record %s -> %s \n", keystr, (const char *)data.dptr ));
ret = NT_STATUS_OK;
} else { /* Unknown record type ! */
- DEBUG(2, ("Found INVALID record %s -> %s\n", keystr, data.dptr));
+ DEBUG(2, ("Found INVALID record %s -> %s\n", keystr, (const char *)data.dptr));
ret = NT_STATUS_INTERNAL_DB_ERROR;
}
@@ -927,7 +927,7 @@ static NTSTATUS idmap_tdb_set_mapping(struct idmap_domain *dom, const struct id_
data = tdb_fetch(ctx->tdb, ksid);
if (data.dptr) {
- DEBUG(10, ("Deleting existing mapping %s <-> %s\n", data.dptr, ksidstr ));
+ DEBUG(10, ("Deleting existing mapping %s <-> %s\n", (const char *)data.dptr, ksidstr ));
tdb_delete(ctx->tdb, data);
tdb_delete(ctx->tdb, ksid);
SAFE_FREE(data.dptr);
@@ -935,7 +935,7 @@ static NTSTATUS idmap_tdb_set_mapping(struct idmap_domain *dom, const struct id_
data = tdb_fetch(ctx->tdb, kid);
if (data.dptr) {
- DEBUG(10,("Deleting existing mapping %s <-> %s\n", data.dptr, kidstr ));
+ DEBUG(10,("Deleting existing mapping %s <-> %s\n", (const char *)data.dptr, kidstr ));
tdb_delete(ctx->tdb, data);
tdb_delete(ctx->tdb, kid);
SAFE_FREE(data.dptr);
@@ -1040,7 +1040,7 @@ static NTSTATUS idmap_tdb_remove_mapping(struct idmap_domain *dom, const struct
if ((data.dsize != kid.dsize) ||
(memcmp(data.dptr, kid.dptr, data.dsize) != 0)) {
DEBUG(10,("Specified SID does not map to specified ID\n"));
- DEBUGADD(10,("Actual mapping is %s -> %s\n", ksidstr, data.dptr));
+ DEBUGADD(10,("Actual mapping is %s -> %s\n", ksidstr, (const char *)data.dptr));
tdb_chainunlock(ctx->tdb, ksid);
ret = NT_STATUS_NONE_MAPPED;
goto done;
@@ -1100,7 +1100,7 @@ static int idmap_tdb_dump_one_entry(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA val
int num_maps = *data->num_maps;
/* ignore any record but the ones with a SID as key */
- if (strncmp(key.dptr, "S-", 2) == 0) {
+ if (strncmp((const char *)key.dptr, "S-", 2) == 0) {
maps = talloc_realloc(NULL, *data->maps, struct id_map, num_maps+1);
if ( ! maps) {
@@ -1116,21 +1116,21 @@ static int idmap_tdb_dump_one_entry(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA val
return -1;
}
- if (!string_to_sid(maps[num_maps].sid, key.dptr)) {
- DEBUG(10,("INVALID record %s\n", key.dptr));
+ if (!string_to_sid(maps[num_maps].sid, (const char *)key.dptr)) {
+ DEBUG(10,("INVALID record %s\n", (const char *)key.dptr));
/* continue even with errors */
return 0;
}
/* Try a UID record. */
- if (sscanf(value.dptr, "UID %u", &(maps[num_maps].xid.id)) == 1) {
+ if (sscanf((const char *)value.dptr, "UID %u", &(maps[num_maps].xid.id)) == 1) {
maps[num_maps].xid.type = ID_TYPE_UID;
maps[num_maps].status = ID_MAPPED;
*data->num_maps = num_maps + 1;
/* Try a GID record. */
} else
- if (sscanf(value.dptr, "GID %u", &(maps[num_maps].xid.id)) == 1) {
+ if (sscanf((const char *)value.dptr, "GID %u", &(maps[num_maps].xid.id)) == 1) {
maps[num_maps].xid.type = ID_TYPE_GID;
maps[num_maps].status = ID_MAPPED;
*data->num_maps = num_maps + 1;
@@ -1138,7 +1138,8 @@ static int idmap_tdb_dump_one_entry(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA val
/* Unknown record type ! */
} else {
maps[num_maps].status = ID_UNKNOWN;
- DEBUG(2, ("Found INVALID record %s -> %s\n", key.dptr, value.dptr));
+ DEBUG(2, ("Found INVALID record %s -> %s\n",
+ (const char *)key.dptr, (const char *)value.dptr));
/* do not increment num_maps */
}
}
diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c
index c09db4d20c..8a1241d8d0 100644
--- a/source3/nsswitch/winbindd_cache.c
+++ b/source3/nsswitch/winbindd_cache.c
@@ -378,7 +378,7 @@ static NTSTATUS store_cache_seqnum( struct winbindd_domain *domain )
{
TDB_DATA data;
fstring key_str;
- char buf[8];
+ uint8 buf[8];
if (!wcache->tdb) {
DEBUG(10,("store_cache_seqnum: tdb == NULL\n"));
@@ -756,7 +756,7 @@ static void centry_end(struct cache_entry *centry, const char *format, ...)
va_end(ap);
key = string_tdb_data(kstr);
- data.dptr = (char *)centry->data;
+ data.dptr = centry->data;
data.dsize = centry->ofs;
tdb_store(wcache->tdb, key, data, TDB_REPLACE);
@@ -2081,8 +2081,8 @@ do_query:
static int traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf,
void *state)
{
- if (strncmp(kbuf.dptr, "UL/", 3) == 0 ||
- strncmp(kbuf.dptr, "GL/", 3) == 0)
+ if (strncmp((const char *)kbuf.dptr, "UL/", 3) == 0 ||
+ strncmp((const char *)kbuf.dptr, "GL/", 3) == 0)
tdb_delete(the_tdb, kbuf);
return 0;
@@ -2152,7 +2152,7 @@ void cache_store_response(pid_t pid, struct winbindd_response *response)
fstr_sprintf(key_str, "DR/%d", pid);
if (tdb_store(wcache->tdb, string_tdb_data(key_str),
- make_tdb_data((const char *)response, sizeof(*response)),
+ make_tdb_data((uint8 *)response, sizeof(*response)),
TDB_REPLACE) == -1)
return;
@@ -2166,7 +2166,7 @@ void cache_store_response(pid_t pid, struct winbindd_response *response)
fstr_sprintf(key_str, "DE/%d", pid);
if (tdb_store(wcache->tdb, string_tdb_data(key_str),
- make_tdb_data((const char *)response->extra_data.data,
+ make_tdb_data(response->extra_data.data,
response->length - sizeof(*response)),
TDB_REPLACE) == 0)
return;
@@ -2342,13 +2342,13 @@ static int traverse_fn_cleanup(TDB_CONTEXT *the_tdb, TDB_DATA kbuf,
{
struct cache_entry *centry;
- centry = wcache_fetch_raw(kbuf.dptr);
+ centry = wcache_fetch_raw((char *)kbuf.dptr);
if (!centry) {
return 0;
}
if (!NT_STATUS_IS_OK(centry->status)) {
- DEBUG(10,("deleting centry %s\n", kbuf.dptr));
+ DEBUG(10,("deleting centry %s\n", (const char *)kbuf.dptr));
tdb_delete(the_tdb, kbuf);
}
@@ -2391,7 +2391,7 @@ static int traverse_fn_cached_creds(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DAT
{
int *cred_count = (int*)state;
- if (strncmp(kbuf.dptr, "CRED/", 5) == 0) {
+ if (strncmp((const char *)kbuf.dptr, "CRED/", 5) == 0) {
(*cred_count)++;
}
return 0;
@@ -2425,7 +2425,7 @@ static int traverse_fn_get_credlist(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DAT
{
struct cred_list *cred;
- if (strncmp(kbuf.dptr, "CRED/", 5) == 0) {
+ if (strncmp((const char *)kbuf.dptr, "CRED/", 5) == 0) {
cred = SMB_MALLOC_P(struct cred_list);
if (cred == NULL) {
@@ -2437,7 +2437,7 @@ static int traverse_fn_get_credlist(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DAT
/* save a copy of the key */
- fstrcpy(cred->name, kbuf.dptr);
+ fstrcpy(cred->name, (const char *)kbuf.dptr);
DLIST_ADD(wcache_cred_list, cred);
}
@@ -2717,7 +2717,7 @@ static int cache_traverse_validate_fn(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_D
for (i = 0; key_val[i].keyname; i++) {
size_t namelen = strlen(key_val[i].keyname);
if (kbuf.dsize >= namelen && (
- strncmp(key_val[i].keyname, kbuf.dptr, namelen)) == 0) {
+ strncmp(key_val[i].keyname, (const char *)kbuf.dptr, namelen)) == 0) {
return key_val[i].validate_data_fn(kbuf, dbuf);
}
}
diff --git a/source3/passdb/login_cache.c b/source3/passdb/login_cache.c
index 5231af8a82..dc13173a3f 100644
--- a/source3/passdb/login_cache.c
+++ b/source3/passdb/login_cache.c
@@ -139,7 +139,7 @@ BOOL login_cache_write(const struct samu *sampass, LOGIN_CACHE entry)
entry.acct_ctrl,
entry.bad_password_count,
entry.bad_password_time);
- databuf.dptr = SMB_MALLOC_ARRAY(char, databuf.dsize);
+ databuf.dptr = SMB_MALLOC_ARRAY(uint8, databuf.dsize);
if (!databuf.dptr) {
SAFE_FREE(keystr);
return False;
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 269b49e21c..a061977f3c 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -889,7 +889,7 @@ BOOL init_sam_from_buffer_v3(struct samu *sampass, uint8 *buf, uint32 buflen)
/* TDB_FORMAT_STRING_V3 "dddddddBBBBBBBBBBBBddBBBdwdBwwd" */
/* unpack the buffer into variables */
- len = tdb_unpack ((char *)buf, buflen, TDB_FORMAT_STRING_V3,
+ len = tdb_unpack (buf, buflen, TDB_FORMAT_STRING_V3,
&logon_time, /* d */
&logoff_time, /* d */
&kickoff_time, /* d */
@@ -1294,7 +1294,7 @@ uint32 init_buffer_from_sam_v3 (uint8 **buf, struct samu *sampass, BOOL size_onl
}
/* now for the real call to tdb_pack() */
- buflen = tdb_pack((char *)*buf, len, TDB_FORMAT_STRING_V3,
+ buflen = tdb_pack(*buf, len, TDB_FORMAT_STRING_V3,
logon_time, /* d */
logoff_time, /* d */
kickoff_time, /* d */
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 37ee19028a..2cb92e542f 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -115,7 +115,7 @@ static BOOL init_sam_from_buffer_v0(struct samu *sampass, uint8 *buf, uint32 buf
/* TDB_FORMAT_STRING_V0 "ddddddBBBBBBBBBBBBddBBwdwdBwwd" */
/* unpack the buffer into variables */
- len = tdb_unpack ((char *)buf, buflen, TDB_FORMAT_STRING_V0,
+ len = tdb_unpack (buf, buflen, TDB_FORMAT_STRING_V0,
&logon_time, /* d */
&logoff_time, /* d */
&kickoff_time, /* d */
@@ -301,7 +301,7 @@ static BOOL init_sam_from_buffer_v1(struct samu *sampass, uint8 *buf, uint32 buf
/* TDB_FORMAT_STRING_V1 "dddddddBBBBBBBBBBBBddBBwdwdBwwd" */
/* unpack the buffer into variables */
- len = tdb_unpack ((char *)buf, buflen, TDB_FORMAT_STRING_V1,
+ len = tdb_unpack (buf, buflen, TDB_FORMAT_STRING_V1,
&logon_time, /* d */
&logoff_time, /* d */
&kickoff_time, /* d */
@@ -493,7 +493,7 @@ BOOL init_sam_from_buffer_v2(struct samu *sampass, uint8 *buf, uint32 buflen)
/* TDB_FORMAT_STRING_V2 "dddddddBBBBBBBBBBBBddBBBwwdBwwd" */
/* unpack the buffer into variables */
- len = tdb_unpack ((char *)buf, buflen, TDB_FORMAT_STRING_V2,
+ len = tdb_unpack (buf, buflen, TDB_FORMAT_STRING_V2,
&logon_time, /* d */
&logoff_time, /* d */
&kickoff_time, /* d */
@@ -715,7 +715,7 @@ static BOOL tdbsam_convert(int32 from)
while (key.dptr) {
/* skip all non-USER entries (eg. RIDs) */
- while ((key.dsize != 0) && (strncmp(key.dptr, prefix, strlen (prefix)))) {
+ while ((key.dsize != 0) && (strncmp((const char *)key.dptr, prefix, strlen (prefix)))) {
old_key = key;
/* increment to next in line */
key = tdb_nextkey(tdbsam, key);
@@ -768,7 +768,8 @@ static BOOL tdbsam_convert(int32 from)
/* pack from the buffer into the new format */
- DEBUG(10,("tdbsam_convert: Try packing a record (key:%s) (version:%d)\n", key.dptr, from));
+ DEBUG(10,("tdbsam_convert: Try packing a record (key:%s) (version:%d)\n",
+ (const char *)key.dptr, from));
data.dsize = init_buffer_from_sam (&buf, user, False);
TALLOC_FREE(user );
@@ -776,7 +777,7 @@ static BOOL tdbsam_convert(int32 from)
DEBUG(0,("tdbsam_convert: cannot pack the struct samu into the new format\n"));
return False;
}
- data.dptr = (char *)buf;
+ data.dptr = buf;
/* Store the buffer inside the TDBSAM */
if (tdb_store(tdbsam, key, data, TDB_MODIFY) != TDB_SUCCESS) {
@@ -901,7 +902,7 @@ static int tdbsam_traverse_setpwent(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data,
int prefixlen = strlen (prefix);
struct pwent_list *ptr;
- if ( strncmp(key.dptr, prefix, prefixlen) == 0 ) {
+ if ( strncmp((const char *)key.dptr, prefix, prefixlen) == 0 ) {
if ( !(ptr=SMB_MALLOC_P(struct pwent_list)) ) {
DEBUG(0,("tdbsam_traverse_setpwent: Failed to malloc new entry for list\n"));
@@ -912,7 +913,7 @@ static int tdbsam_traverse_setpwent(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data,
/* save a copy of the key */
- ptr->key.dptr = (char *)memdup( key.dptr, key.dsize );
+ ptr->key.dptr = (uint8 *)memdup( key.dptr, key.dsize );
if (!ptr->key.dptr) {
DEBUG(0,("tdbsam_traverse_setpwent: memdup failed\n"));
/* just return 0 and let the traversal continue */
@@ -1061,7 +1062,7 @@ static NTSTATUS tdbsam_getsampwnam (struct pdb_methods *my_methods, struct samu
/* unpack the buffer */
- if (!init_sam_from_buffer(user, (unsigned char *)data.dptr, data.dsize)) {
+ if (!init_sam_from_buffer(user, data.dptr, data.dsize)) {
DEBUG(0,("pdb_getsampwent: Bad struct samu entry returned from TDB!\n"));
SAFE_FREE(data.dptr);
tdbsam_close();
@@ -1113,7 +1114,7 @@ static NTSTATUS tdbsam_getsampwrid (struct pdb_methods *my_methods, struct samu
goto done;
}
- fstrcpy(name, data.dptr);
+ fstrcpy(name, (const char *)data.dptr);
SAFE_FREE(data.dptr);
nt_status = tdbsam_getsampwnam (my_methods, user, name);
@@ -1237,7 +1238,7 @@ static BOOL tdb_update_samacct_only( struct samu* newpwd, int flag )
ret = False;
goto done;
}
- data.dptr = (char *)buf;
+ data.dptr = buf;
fstrcpy(name, pdb_get_username(newpwd));
strlower_m(name);
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index ebdf28c241..c96f38694a 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -105,7 +105,7 @@ BOOL secrets_store(const char *key, const void *data, size_t size)
if (!tdb)
return False;
return tdb_trans_store(tdb, string_tdb_data(key),
- make_tdb_data((const char *)data, size),
+ make_tdb_data(data, size),
TDB_REPLACE) == 0;
}
@@ -330,7 +330,7 @@ BOOL secrets_fetch_trust_account_password(const char *domain, uint8 ret_pwd[16],
*
* @return length of the packed representation of the whole structure
**/
-static size_t tdb_sid_pack(char* pack_buf, int bufsize, DOM_SID* sid)
+static size_t tdb_sid_pack(uint8 *pack_buf, int bufsize, DOM_SID* sid)
{
int idx;
size_t len = 0;
@@ -362,7 +362,7 @@ static size_t tdb_sid_pack(char* pack_buf, int bufsize, DOM_SID* sid)
*
* @return size of structure unpacked from buffer
**/
-static size_t tdb_sid_unpack(char* pack_buf, int bufsize, DOM_SID* sid)
+static size_t tdb_sid_unpack(uint8 *pack_buf, int bufsize, DOM_SID* sid)
{
int idx, len = 0;
@@ -393,7 +393,7 @@ static size_t tdb_sid_unpack(char* pack_buf, int bufsize, DOM_SID* sid)
*
* @return length of the packed representation of the whole structure
**/
-static size_t tdb_trusted_dom_pass_pack(char* pack_buf, int bufsize,
+static size_t tdb_trusted_dom_pass_pack(uint8 *pack_buf, int bufsize,
TRUSTED_DOM_PASS* pass)
{
int idx, len = 0;
@@ -427,7 +427,7 @@ static size_t tdb_trusted_dom_pass_pack(char* pack_buf, int bufsize,
*
* @return size of structure unpacked from buffer
**/
-static size_t tdb_trusted_dom_pass_unpack(char* pack_buf, int bufsize,
+static size_t tdb_trusted_dom_pass_unpack(uint8 *pack_buf, int bufsize,
TRUSTED_DOM_PASS* pass)
{
int idx, len = 0;
@@ -462,13 +462,13 @@ BOOL secrets_fetch_trusted_domain_password(const char *domain, char** pwd,
size_t size = 0;
/* unpacking structures */
- char* pass_buf;
+ uint8 *pass_buf;
int pass_len = 0;
ZERO_STRUCT(pass);
/* fetching trusted domain password structure */
- if (!(pass_buf = (char *)secrets_fetch(trustdom_keystr(domain),
+ if (!(pass_buf = (uint8 *)secrets_fetch(trustdom_keystr(domain),
&size))) {
DEBUG(5, ("secrets_fetch failed!\n"));
return False;
@@ -543,7 +543,7 @@ BOOL secrets_store_trusted_domain_password(const char* domain, const char* pwd,
/* domain sid */
sid_copy(&pass.domain_sid, sid);
- pass_len = tdb_trusted_dom_pass_pack(pass_buf, pass_buf_len, &pass);
+ pass_len = tdb_trusted_dom_pass_pack((uint8 *)pass_buf, pass_buf_len, &pass);
return secrets_store(trustdom_keystr(domain), (void *)&pass_buf, pass_len);
}
@@ -813,7 +813,7 @@ NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains,
/* searching for keys in secrets db -- way to go ... */
for (k = keys; k; k = k->next) {
- char *packed_pass;
+ uint8 *packed_pass;
size_t size = 0, packed_size = 0;
struct trusted_dom_pass pass;
char *secrets_key;
@@ -821,7 +821,7 @@ NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains,
/* important: ensure null-termination of the key string */
secrets_key = talloc_strndup(tmp_ctx,
- k->node_key.dptr,
+ (const char *)k->node_key.dptr,
k->node_key.dsize);
if (!secrets_key) {
DEBUG(0, ("strndup failed!\n"));
@@ -830,7 +830,7 @@ NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains,
return NT_STATUS_NO_MEMORY;
}
- packed_pass = (char *)secrets_fetch(secrets_key, &size);
+ packed_pass = (uint8 *)secrets_fetch(secrets_key, &size);
packed_size = tdb_trusted_dom_pass_unpack(packed_pass, size,
&pass);
/* packed representation isn't needed anymore */
@@ -1033,7 +1033,7 @@ static TDB_CONTEXT *open_schannel_session_store(TALLOC_CTX *mem_ctx)
if (vers.dptr == NULL) {
/* First opener, no version. */
SIVAL(&ver,0,1);
- vers.dptr = (char *)&ver;
+ vers.dptr = (uint8 *)&ver;
vers.dsize = 4;
tdb_store_bystring(tdb_sc, "SCHANNEL_STORE_VERSION", vers, TDB_REPLACE);
vers.dptr = NULL;
@@ -1090,7 +1090,7 @@ BOOL secrets_store_schannel_session_info(TALLOC_CTX *mem_ctx,
pdc->remote_machine,
pdc->domain);
- value.dptr = (char *)TALLOC(mem_ctx, value.dsize);
+ value.dptr = TALLOC_ARRAY(mem_ctx, uint8, value.dsize);
if (!value.dptr) {
TALLOC_FREE(keystr);
return False;
diff --git a/source3/printing/notify.c b/source3/printing/notify.c
index 7d5b702781..2db8768395 100644
--- a/source3/printing/notify.c
+++ b/source3/printing/notify.c
@@ -31,7 +31,7 @@ static struct notify_queue {
struct notify_queue *next, *prev;
struct spoolss_notify_msg *msg;
struct timeval tv;
- char *buf;
+ uint8 *buf;
size_t buflen;
} *notify_queue_head = NULL;
@@ -75,7 +75,7 @@ BOOL print_notify_messages_pending(void)
static BOOL flatten_message(struct notify_queue *q)
{
struct spoolss_notify_msg *msg = q->msg;
- char *buf = NULL;
+ uint8 *buf = NULL;
size_t buflen = 0, len;
again:
@@ -99,7 +99,7 @@ again:
msg->len, msg->notify.data);
if (buflen != len) {
- buf = (char *)TALLOC_REALLOC(send_ctx, buf, len);
+ buf = (uint8 *)TALLOC_REALLOC(send_ctx, buf, len);
if (!buf)
return False;
buflen = len;
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 2bddf4d530..7a3d14703f 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -279,7 +279,7 @@ static BOOL upgrade_to_version_3(void)
dbuf = tdb_fetch(tdb_drivers, kbuf);
- if (strncmp(kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) == 0) {
+ if (strncmp((const char *)kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) == 0) {
DEBUG(0,("upgrade_to_version_3:moving form\n"));
if (tdb_store(tdb_forms, kbuf, dbuf, TDB_REPLACE) != 0) {
SAFE_FREE(dbuf.dptr);
@@ -293,7 +293,7 @@ static BOOL upgrade_to_version_3(void)
}
}
- if (strncmp(kbuf.dptr, PRINTERS_PREFIX, strlen(PRINTERS_PREFIX)) == 0) {
+ if (strncmp((const char *)kbuf.dptr, PRINTERS_PREFIX, strlen(PRINTERS_PREFIX)) == 0) {
DEBUG(0,("upgrade_to_version_3:moving printer\n"));
if (tdb_store(tdb_printers, kbuf, dbuf, TDB_REPLACE) != 0) {
SAFE_FREE(dbuf.dptr);
@@ -307,7 +307,7 @@ static BOOL upgrade_to_version_3(void)
}
}
- if (strncmp(kbuf.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX)) == 0) {
+ if (strncmp((const char *)kbuf.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX)) == 0) {
DEBUG(0,("upgrade_to_version_3:moving secdesc\n"));
if (tdb_store(tdb_printers, kbuf, dbuf, TDB_REPLACE) != 0) {
SAFE_FREE(dbuf.dptr);
@@ -352,7 +352,7 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
return 0;
}
- if ( strncmp( key.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX) ) != 0 ) {
+ if ( strncmp((const char *) key.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX) ) != 0 ) {
return 0;
}
@@ -361,11 +361,12 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
ZERO_STRUCT( ps );
prs_init( &ps, 0, ctx, UNMARSHALL );
- prs_give_memory( &ps, data.dptr, data.dsize, False );
+ prs_give_memory( &ps, (char *)data.dptr, data.dsize, False );
if ( !sec_io_desc_buf( "sec_desc_upg_fn", &sd_orig, &ps, 1 ) ) {
/* delete bad entries */
- DEBUG(0,("sec_desc_upg_fn: Failed to parse original sec_desc for %si. Deleting....\n", key.dptr ));
+ DEBUG(0,("sec_desc_upg_fn: Failed to parse original sec_desc for %si. Deleting....\n",
+ (const char *)key.dptr ));
tdb_delete( tdb_printers, key );
prs_mem_free( &ps );
return 0;
@@ -439,7 +440,7 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
return 0;
}
- data.dptr = prs_data_p( &ps );
+ data.dptr = (uint8 *)prs_data_p( &ps );
data.dsize = sd_size;
result = tdb_store( tdb_printers, key, data, TDB_REPLACE );
@@ -489,11 +490,11 @@ static int normalize_printers_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
/* upgrade printer records and security descriptors */
- if ( strncmp( key.dptr, PRINTERS_PREFIX, strlen(PRINTERS_PREFIX) ) == 0 ) {
- new_key = make_printer_tdbkey( key.dptr+strlen(PRINTERS_PREFIX) );
+ if ( strncmp((const char *) key.dptr, PRINTERS_PREFIX, strlen(PRINTERS_PREFIX) ) == 0 ) {
+ new_key = make_printer_tdbkey( (const char *)key.dptr+strlen(PRINTERS_PREFIX) );
}
- else if ( strncmp( key.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX) ) == 0 ) {
- new_key = make_printers_secdesc_tdbkey( key.dptr+strlen(SECDESC_PREFIX) );
+ else if ( strncmp((const char *) key.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX) ) == 0 ) {
+ new_key = make_printers_secdesc_tdbkey( (const char *)key.dptr+strlen(SECDESC_PREFIX) );
}
else {
/* ignore this record */
@@ -786,14 +787,14 @@ int get_ntforms(nt_forms_struct **list)
kbuf.dptr;
newkey = tdb_nextkey(tdb_forms, kbuf), safe_free(kbuf.dptr), kbuf=newkey)
{
- if (strncmp(kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) != 0)
+ if (strncmp((const char *)kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) != 0)
continue;
dbuf = tdb_fetch(tdb_forms, kbuf);
if (!dbuf.dptr)
continue;
- fstrcpy(form.name, kbuf.dptr+strlen(FORMS_PREFIX));
+ fstrcpy(form.name, (const char *)kbuf.dptr+strlen(FORMS_PREFIX));
ret = tdb_unpack(dbuf.dptr, dbuf.dsize, "dddddddd",
&i, &form.flag, &form.width, &form.length, &form.left,
&form.top, &form.right, &form.bottom);
@@ -826,14 +827,14 @@ int write_ntforms(nt_forms_struct **list, int number)
for (i=0;i<number;i++) {
/* save index, so list is rebuilt in correct order */
- len = tdb_pack(buf, sizeof(buf), "dddddddd",
+ len = tdb_pack((uint8 *)buf, sizeof(buf), "dddddddd",
i, (*list)[i].flag, (*list)[i].width, (*list)[i].length,
(*list)[i].left, (*list)[i].top, (*list)[i].right,
(*list)[i].bottom);
if (len > sizeof(buf)) break;
slprintf(key, sizeof(key)-1, "%s%s", FORMS_PREFIX, (*list)[i].name);
dbuf.dsize = len;
- dbuf.dptr = buf;
+ dbuf.dptr = (uint8 *)buf;
if (tdb_store_bystring(tdb_forms, key, dbuf, TDB_REPLACE) != 0) break;
}
@@ -974,7 +975,7 @@ int get_ntdrivers(fstring **list, const char *architecture, uint32 version)
kbuf.dptr;
newkey = tdb_nextkey(tdb_drivers, kbuf), safe_free(kbuf.dptr), kbuf=newkey) {
- if (strncmp(kbuf.dptr, key, strlen(key)) != 0)
+ if (strncmp((const char *)kbuf.dptr, key, strlen(key)) != 0)
continue;
if((*list = SMB_REALLOC_ARRAY(*list, fstring, total+1)) == NULL) {
@@ -982,7 +983,7 @@ int get_ntdrivers(fstring **list, const char *architecture, uint32 version)
return -1;
}
- fstrcpy((*list)[total], kbuf.dptr+strlen(key));
+ fstrcpy((*list)[total], (const char *)kbuf.dptr+strlen(key));
total++;
}
@@ -1929,7 +1930,7 @@ static uint32 add_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *driver)
pstring directory;
fstring temp_name;
pstring key;
- char *buf;
+ uint8 *buf;
int i, ret;
TDB_DATA dbuf;
@@ -2006,7 +2007,7 @@ static uint32 add_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *driver)
}
if (len != buflen) {
- buf = (char *)SMB_REALLOC(buf, len);
+ buf = (uint8 *)SMB_REALLOC(buf, len);
if (!buf) {
DEBUG(0,("add_a_printer_driver_3: failed to enlarge buffer\n!"));
ret = -1;
@@ -2208,7 +2209,7 @@ static uint32 dump_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32
/****************************************************************************
****************************************************************************/
-int pack_devicemode(NT_DEVICEMODE *nt_devmode, char *buf, int buflen)
+int pack_devicemode(NT_DEVICEMODE *nt_devmode, uint8 *buf, int buflen)
{
int len = 0;
@@ -2272,7 +2273,7 @@ int pack_devicemode(NT_DEVICEMODE *nt_devmode, char *buf, int buflen)
Pack all values in all printer keys
***************************************************************************/
-static int pack_values(NT_PRINTER_DATA *data, char *buf, int buflen)
+static int pack_values(NT_PRINTER_DATA *data, uint8 *buf, int buflen)
{
int len = 0;
int i, j;
@@ -2362,7 +2363,7 @@ uint32 del_a_printer(const char *sharename)
****************************************************************************/
static WERROR update_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info)
{
- char *buf;
+ uint8 *buf;
int buflen, len;
WERROR ret;
TDB_DATA kbuf, dbuf;
@@ -2429,7 +2430,7 @@ static WERROR update_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info)
len += pack_values( info->data, buf+len, buflen-len );
if (buflen != len) {
- buf = (char *)SMB_REALLOC(buf, len);
+ buf = (uint8 *)SMB_REALLOC(buf, len);
if (!buf) {
DEBUG(0,("update_a_printer_2: failed to enlarge buffer!\n"));
ret = WERR_NOMEM;
@@ -2587,7 +2588,7 @@ static void free_nt_printer_info_level_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr)
/****************************************************************************
****************************************************************************/
-int unpack_devicemode(NT_DEVICEMODE **nt_devmode, char *buf, int buflen)
+int unpack_devicemode(NT_DEVICEMODE **nt_devmode, const uint8 *buf, int buflen)
{
int len = 0;
int extra_len = 0;
@@ -3524,7 +3525,7 @@ REGISTRY_VALUE* get_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key,
Unpack a list of registry values frem the TDB
***************************************************************************/
-static int unpack_values(NT_PRINTER_DATA *printer_data, char *buf, int buflen)
+static int unpack_values(NT_PRINTER_DATA *printer_data, const uint8 *buf, int buflen)
{
int len = 0;
uint32 type;
@@ -4206,7 +4207,7 @@ BOOL del_driver_init(char *drivername)
static uint32 update_driver_init_2(NT_PRINTER_INFO_LEVEL_2 *info)
{
pstring key;
- char *buf;
+ uint8 *buf;
int buflen, len, ret;
TDB_DATA dbuf;
@@ -4220,7 +4221,7 @@ static uint32 update_driver_init_2(NT_PRINTER_INFO_LEVEL_2 *info)
len += pack_values( info->data, buf+len, buflen-len );
if (buflen < len) {
- buf = (char *)SMB_REALLOC(buf, len);
+ buf = (uint8 *)SMB_REALLOC(buf, len);
if (!buf) {
DEBUG(0, ("update_driver_init_2: failed to enlarge buffer!\n"));
ret = -1;
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 5aac04aa8d..8b61f07680 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -76,7 +76,7 @@ uint16 pjobid_to_rap(const char* sharename, uint32 jobid)
ZERO_STRUCT( jinfo );
fstrcpy( jinfo.sharename, sharename );
jinfo.jobid = jobid;
- key.dptr = (char*)&jinfo;
+ key.dptr = (uint8 *)&jinfo;
key.dsize = sizeof(jinfo);
data = tdb_fetch(rap_tdb, key);
@@ -93,7 +93,7 @@ uint16 pjobid_to_rap(const char* sharename, uint32 jobid)
if (rap_jobid == 0)
rap_jobid = ++next_rap_jobid;
SSVAL(buf,0,rap_jobid);
- data.dptr = (char*)buf;
+ data.dptr = buf;
data.dsize = sizeof(rap_jobid);
tdb_store(rap_tdb, key, data, TDB_REPLACE);
tdb_store(rap_tdb, data, key, TDB_REPLACE);
@@ -114,7 +114,7 @@ BOOL rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid)
return False;
SSVAL(buf,0,rap_jobid);
- key.dptr = (char*)buf;
+ key.dptr = buf;
key.dsize = sizeof(rap_jobid);
data = tdb_fetch(rap_tdb, key);
if ( data.dptr && data.dsize == sizeof(struct rap_jobid_key) )
@@ -149,7 +149,7 @@ static void rap_jobid_delete(const char* sharename, uint32 jobid)
ZERO_STRUCT( jinfo );
fstrcpy( jinfo.sharename, sharename );
jinfo.jobid = jobid;
- key.dptr = (char*)&jinfo;
+ key.dptr = (uint8 *)&jinfo;
key.dsize = sizeof(jinfo);
data = tdb_fetch(rap_tdb, key);
@@ -166,7 +166,7 @@ static void rap_jobid_delete(const char* sharename, uint32 jobid)
rap_jobid = SVAL(data.dptr, 0);
SAFE_FREE(data.dptr);
SSVAL(buf,0,rap_jobid);
- data.dptr = (char*)buf;
+ data.dptr = buf;
data.dsize = sizeof(rap_jobid);
tdb_delete(rap_tdb, key);
tdb_delete(rap_tdb, data);
@@ -273,7 +273,7 @@ static TDB_DATA print_key(uint32 jobid)
TDB_DATA ret;
SIVAL(&j, 0, jobid);
- ret.dptr = (char *)&j;
+ ret.dptr = (uint8 *)&j;
ret.dsize = sizeof(j);
return ret;
}
@@ -282,7 +282,7 @@ static TDB_DATA print_key(uint32 jobid)
unpack a pjob from a tdb buffer
***********************************************************************/
-int unpack_pjob( char* buf, int buflen, struct printjob *pjob )
+int unpack_pjob( uint8 *buf, int buflen, struct printjob *pjob )
{
int len = 0;
int used;
@@ -518,7 +518,7 @@ static BOOL pjob_store(const char* sharename, uint32 jobid, struct printjob *pjo
TDB_DATA old_data, new_data;
BOOL ret = False;
struct tdb_print_db *pdb = get_print_db_byname(sharename);
- char *buf = NULL;
+ uint8 *buf = NULL;
int len, newlen, buflen;
@@ -554,7 +554,7 @@ static BOOL pjob_store(const char* sharename, uint32 jobid, struct printjob *pjo
len += pack_devicemode(pjob->nt_devmode, buf+len, buflen-len);
if (buflen != len) {
- buf = (char *)SMB_REALLOC(buf, len);
+ buf = (uint8 *)SMB_REALLOC(buf, len);
if (!buf) {
DEBUG(0,("pjob_store: failed to enlarge buffer!\n"));
goto done;
@@ -917,7 +917,7 @@ static void set_updating_pid(const fstring sharename, BOOL updating)
}
SIVAL( buffer, 0, updating_pid);
- data.dptr = (char *)buffer;
+ data.dptr = buffer;
data.dsize = 4; /* we always assume this is a 4 byte value */
tdb_store(pdb->tdb, key, data, TDB_REPLACE);
@@ -984,7 +984,7 @@ static void store_queue_struct(struct tdb_print_db *pdb, struct traverse_struct
queue[i].fs_file);
}
- if ((data.dptr = (char *)SMB_MALLOC(data.dsize)) == NULL)
+ if ((data.dptr = (uint8 *)SMB_MALLOC(data.dsize)) == NULL)
return;
len = 0;
@@ -1234,7 +1234,7 @@ static void print_queue_update_internal( const char *sharename,
key = string_tdb_data(keystr);
status.qcount = qcount;
- data.dptr = (char *)&status;
+ data.dptr = (uint8 *)&status;
data.dsize = sizeof(status);
tdb_store(pdb->tdb, key, data, TDB_REPLACE);
@@ -1357,7 +1357,7 @@ static void print_queue_receive(int msg_type, struct process_id src,
int printing_type;
size_t len;
- len = tdb_unpack( (char *)buf, msglen, "fdPP",
+ len = tdb_unpack( buf, msglen, "fdPP",
sharename,
&printing_type,
lpqcommand,
@@ -1442,7 +1442,7 @@ static void print_queue_update(int snum, BOOL force)
fstring key;
fstring sharename;
pstring lpqcommand, lprmcommand;
- char *buffer = NULL;
+ uint8 *buffer = NULL;
size_t len = 0;
size_t newlen;
struct tdb_print_db *pdb;
@@ -1496,7 +1496,7 @@ static void print_queue_update(int snum, BOOL force)
lpqcommand,
lprmcommand );
- buffer = SMB_XMALLOC_ARRAY( char, len );
+ buffer = SMB_XMALLOC_ARRAY( uint8, len );
/* now pack the buffer */
newlen = tdb_pack( buffer, len, "fdPP",
@@ -1604,7 +1604,7 @@ BOOL print_notify_register_pid(int snum)
if (i == data.dsize) {
/* We weren't in the list. Realloc. */
- data.dptr = (char *)SMB_REALLOC(data.dptr, data.dsize + 8);
+ data.dptr = (uint8 *)SMB_REALLOC(data.dptr, data.dsize + 8);
if (!data.dptr) {
DEBUG(0,("print_notify_register_pid: Relloc fail for printer %s\n",
printername));
@@ -2299,7 +2299,7 @@ static BOOL add_to_jobs_changed(struct tdb_print_db *pdb, uint32 jobid)
uint32 store_jobid;
SIVAL(&store_jobid, 0, jobid);
- data.dptr = (char *)&store_jobid;
+ data.dptr = (uint8 *)&store_jobid;
data.dsize = 4;
DEBUG(10,("add_to_jobs_changed: Added jobid %u\n", (unsigned int)jobid ));
diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c
index 3050c852df..224dd7e0f6 100644
--- a/source3/registry/reg_db.c
+++ b/source3/registry/reg_db.c
@@ -329,7 +329,7 @@ int regdb_close( void )
static BOOL regdb_store_keys_internal( const char *key, REGSUBKEY_CTR *ctr )
{
TDB_DATA dbuf;
- char *buffer;
+ uint8 *buffer;
int i = 0;
uint32 len, buflen;
BOOL ret = True;
@@ -344,7 +344,7 @@ static BOOL regdb_store_keys_internal( const char *key, REGSUBKEY_CTR *ctr )
/* allocate some initial memory */
- if (!(buffer = (char *)SMB_MALLOC(sizeof(pstring)))) {
+ if (!(buffer = (uint8 *)SMB_MALLOC(sizeof(pstring)))) {
return False;
}
buflen = sizeof(pstring);
@@ -360,7 +360,7 @@ static BOOL regdb_store_keys_internal( const char *key, REGSUBKEY_CTR *ctr )
len += tdb_pack( buffer+len, buflen-len, "f", regsubkey_ctr_specific_key(ctr, i) );
if ( len > buflen ) {
/* allocate some extra space */
- if ((buffer = (char *)SMB_REALLOC( buffer, len*2 )) == NULL) {
+ if ((buffer = (uint8 *)SMB_REALLOC( buffer, len*2 )) == NULL) {
DEBUG(0,("regdb_store_keys: Failed to realloc memory of size [%d]\n", len*2));
ret = False;
goto done;
@@ -507,7 +507,7 @@ int regdb_fetch_keys( const char* key, REGSUBKEY_CTR *ctr )
pstring path;
uint32 num_items;
TDB_DATA dbuf;
- char *buf;
+ uint8 *buf;
uint32 buflen, len;
int i;
fstring subkeyname;
@@ -548,7 +548,7 @@ int regdb_fetch_keys( const char* key, REGSUBKEY_CTR *ctr )
Unpack a list of registry values frem the TDB
***************************************************************************/
-static int regdb_unpack_values(REGVAL_CTR *values, char *buf, int buflen)
+static int regdb_unpack_values(REGVAL_CTR *values, uint8 *buf, int buflen)
{
int len = 0;
uint32 type;
@@ -593,7 +593,7 @@ static int regdb_unpack_values(REGVAL_CTR *values, char *buf, int buflen)
Pack all values in all printer keys
***************************************************************************/
-static int regdb_pack_values(REGVAL_CTR *values, char *buf, int buflen)
+static int regdb_pack_values(REGVAL_CTR *values, uint8 *buf, int buflen)
{
int len = 0;
int i;
@@ -673,7 +673,7 @@ BOOL regdb_store_values( const char *key, REGVAL_CTR *values )
return False;
}
- data.dptr = SMB_MALLOC_ARRAY( char, len );
+ data.dptr = SMB_MALLOC_ARRAY( uint8, len );
data.dsize = len;
len = regdb_pack_values( values, data.dptr, data.dsize );
diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c
index c90f989515..297e27ecc7 100644
--- a/source3/registry/reg_perfcount.c
+++ b/source3/registry/reg_perfcount.c
@@ -182,7 +182,7 @@ static uint32 _reg_perfcount_multi_sz_from_tdb(TDB_CONTEXT *tdb,
buffer_size = 0;
return buffer_size;
}
- init_unistr2(&name_index, kbuf.dptr, UNI_STR_TERMINATE);
+ init_unistr2(&name_index, (const char *)kbuf.dptr, UNI_STR_TERMINATE);
memcpy(buf1+buffer_size, (char *)name_index.buffer, working_size);
buffer_size += working_size;
/* Now encode the actual name */
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 0fb429b591..632a33cb9a 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -1457,7 +1457,7 @@ BOOL prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32
int tdb_prs_store(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps)
{
TDB_DATA dbuf;
- dbuf.dptr = ps->data_p;
+ dbuf.dptr = (uint8 *)ps->data_p;
dbuf.dsize = prs_offset(ps);
return tdb_trans_store(tdb, kbuf, dbuf, TDB_REPLACE);
}
@@ -1479,7 +1479,7 @@ int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *m
if (!dbuf.dptr)
return -1;
- prs_give_memory(ps, dbuf.dptr, dbuf.dsize, True);
+ prs_give_memory(ps, (char *)dbuf.dptr, dbuf.dsize, True);
return 0;
}
diff --git a/source3/rpc_server/srv_eventlog_lib.c b/source3/rpc_server/srv_eventlog_lib.c
index c853f932ae..c780cf910c 100644
--- a/source3/rpc_server/srv_eventlog_lib.c
+++ b/source3/rpc_server/srv_eventlog_lib.c
@@ -188,7 +188,7 @@ BOOL make_way_for_eventlogs( TDB_CONTEXT * the_tdb, int32 needed,
for ( i = start_record; i < end_record; i++ ) {
/* read a record, add the amt to nbytes */
key.dsize = sizeof( int32 );
- key.dptr = ( char * ) ( int32 * ) & i;
+ key.dptr = ( uint8 * ) ( int32 * ) & i;
ret = tdb_fetch( the_tdb, key );
if ( ret.dsize == 0 ) {
DEBUG( 8,
@@ -233,7 +233,7 @@ BOOL make_way_for_eventlogs( TDB_CONTEXT * the_tdb, int32 needed,
if ( start_record != new_start ) {
for ( i = start_record; i < new_start; i++ ) {
key.dsize = sizeof( int32 );
- key.dptr = ( char * ) ( int32 * ) & i;
+ key.dptr = ( uint8 * ) ( int32 * ) & i;
tdb_delete( the_tdb, key );
}
@@ -500,7 +500,7 @@ int write_eventlog_tdb( TDB_CONTEXT * the_tdb, Eventlog_entry * ee )
next_record = tdb_fetch_int32( the_tdb, EVT_NEXT_RECORD );
n_packed =
- tdb_pack( (char *)packed_ee, ee->record.length + MARGIN,
+ tdb_pack( (uint8 *)packed_ee, ee->record.length + MARGIN,
"ddddddwwwwddddddBBdBBBd", ee->record.length,
ee->record.reserved1, next_record,
ee->record.time_generated, ee->record.time_written,
@@ -529,10 +529,10 @@ int write_eventlog_tdb( TDB_CONTEXT * the_tdb, Eventlog_entry * ee )
/* increment the record count */
kbuf.dsize = sizeof( int32 );
- kbuf.dptr = (char * ) & next_record;
+ kbuf.dptr = (uint8 * ) & next_record;
ebuf.dsize = n_packed;
- ebuf.dptr = (char *)packed_ee;
+ ebuf.dptr = (uint8 *)packed_ee;
if ( tdb_store( the_tdb, kbuf, ebuf, 0 ) ) {
/* DEBUG(1,("write_eventlog_tdb: Can't write record %d to eventlog\n",next_record)); */
diff --git a/source3/rpc_server/srv_eventlog_nt.c b/source3/rpc_server/srv_eventlog_nt.c
index 519be60199..753772642a 100644
--- a/source3/rpc_server/srv_eventlog_nt.c
+++ b/source3/rpc_server/srv_eventlog_nt.c
@@ -295,7 +295,7 @@ static Eventlog_entry *get_eventlog_record( prs_struct * ps, TDB_CONTEXT * tdb,
key.dsize = sizeof( int32 );
srecno = recno;
- key.dptr = ( char * ) &srecno;
+ key.dptr = ( uint8 * ) &srecno;
ret = tdb_fetch( tdb, key );
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index e06d613c74..b33fc6b5b0 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -1073,18 +1073,18 @@ static BOOL notify2_unpack_msg( SPOOLSS_NOTIFY_MSG *msg, struct timeval *tv, voi
/* Unpack message */
- offset += tdb_unpack((char *)buf + offset, len - offset, "f",
+ offset += tdb_unpack((uint8 *)buf + offset, len - offset, "f",
msg->printer);
- offset += tdb_unpack((char *)buf + offset, len - offset, "ddddddd",
+ offset += tdb_unpack((uint8 *)buf + offset, len - offset, "ddddddd",
&tv_sec, &tv_usec,
&msg->type, &msg->field, &msg->id, &msg->len, &msg->flags);
if (msg->len == 0)
- tdb_unpack((char *)buf + offset, len - offset, "dd",
+ tdb_unpack((uint8 *)buf + offset, len - offset, "dd",
&msg->notify.value[0], &msg->notify.value[1]);
else
- tdb_unpack((char *)buf + offset, len - offset, "B",
+ tdb_unpack((uint8 *)buf + offset, len - offset, "B",
&msg->len, &msg->notify.data);
DEBUG(3, ("notify2_unpack_msg: got NOTIFY2 message for printer %s, jobid %u type %d, field 0x%02x, flags 0x%04x\n",
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c
index 7838c5c23d..7e53a29b04 100644
--- a/source3/smbd/connection.c
+++ b/source3/smbd/connection.c
@@ -50,7 +50,7 @@ static void make_conn_key(connection_struct *conn, const char *name, TDB_DATA *p
}
#endif
- pkbuf->dptr = (char *)pkey;
+ pkbuf->dptr = (uint8 *)pkey;
pkbuf->dsize = sizeof(*pkey);
}
@@ -200,7 +200,7 @@ BOOL claim_connection(connection_struct *conn, const char *name,int max_connecti
safe_strcpy(crec.machine,get_remote_machine_name(),sizeof(crec.machine)-1);
safe_strcpy(crec.addr,conn?conn->client_address:client_addr(),sizeof(crec.addr)-1);
- dbuf.dptr = (char *)&crec;
+ dbuf.dptr = (uint8 *)&crec;
dbuf.dsize = sizeof(crec);
if (tdb_store(tdb, kbuf, dbuf, TDB_REPLACE) != 0) {
@@ -313,7 +313,7 @@ BOOL store_pipe_opendb( smb_np_struct *p )
goto done;
}
- data.dptr = (char*)prec;
+ data.dptr = (uint8 *)prec;
data.dsize = sizeof(struct pipe_open_rec);
if ( (pipe_tdb = conn_tdb_ctx() ) == NULL ) {
diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c
index f20e473079..3cc7d1e5c2 100644
--- a/source3/smbd/mangle_hash.c
+++ b/source3/smbd/mangle_hash.c
@@ -502,7 +502,7 @@ static BOOL check_cache( char *s, size_t maxlen, const struct share_params *p )
}
/* If we *did* find it, we need to copy it into the string buffer. */
- (void)safe_strcpy( s, data_val.dptr, maxlen );
+ (void)safe_strcpy( s, (const char *)data_val.dptr, maxlen );
if( saved_ext ) {
/* Replace the saved_ext as it was truncated. */
(void)safe_strcat( s, saved_ext, maxlen );
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index 72b9604935..e1f47540e5 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -231,7 +231,7 @@ static NTSTATUS notify_save(struct notify_context *notify)
NDR_PRINT_DEBUG(notify_array, notify->array);
}
- dbuf.dptr = (char *)blob.data;
+ dbuf.dptr = blob.data;
dbuf.dsize = blob.length;
ret = tdb_store_bystring(notify->w->tdb, NOTIFY_KEY, dbuf, TDB_REPLACE);
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index da2ab40338..a3334a353e 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -140,7 +140,7 @@ BOOL session_claim(user_struct *vuser)
return False;
}
- data.dptr = (char *)&sessionid;
+ data.dptr = (uint8 *)&sessionid;
data.dsize = sizeof(sessionid);
if (tdb_store_bystring(tdb, keystr, data, tdb_store_flag) != 0) {
DEBUG(1,("session_claim: unable to create session id record\n"));
diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c
index 1a2b7a8237..e257483f81 100644
--- a/source3/smbd/statcache.c
+++ b/source3/smbd/statcache.c
@@ -131,7 +131,7 @@ void stat_cache_add( const char *full_orig_name, const char *orig_translated_pat
*/
data_val.dsize = translated_path_length + 1;
- data_val.dptr = translated_path;
+ data_val.dptr = (uint8 *)translated_path;
if (tdb_store_bystring(tdb_stat_cache, original_path, data_val, TDB_REPLACE) != 0) {
DEBUG(0,("stat_cache_add: Error storing entry %s -> %s\n", original_path, translated_path));
@@ -242,7 +242,7 @@ BOOL stat_cache_lookup(connection_struct *conn, pstring name, pstring dirpath,
}
} else {
BOOL retval;
- char *translated_path = data_val.dptr;
+ char *translated_path = (char *)data_val.dptr;
size_t translated_path_length = data_val.dsize - 1;
DEBUG(10,("stat_cache_lookup: lookup succeeded for name [%s] -> [%s]\n", chk_name, translated_path ));
@@ -329,7 +329,7 @@ unsigned int fast_string_hash(TDB_DATA *key)
{
unsigned int n = 0;
const char *p;
- for (p = key->dptr; *p != '\0'; p++) {
+ for (p = (const char *)key->dptr; *p != '\0'; p++) {
n = ((n << 5) + n) ^ (unsigned int)(*p);
}
return n;
diff --git a/source3/tdb/common/freelistcheck.c b/source3/tdb/common/freelistcheck.c
index 3f79a016b8..63d2dbadc2 100644
--- a/source3/tdb/common/freelistcheck.c
+++ b/source3/tdb/common/freelistcheck.c
@@ -39,7 +39,7 @@ static int seen_insert(struct tdb_context *mem_tdb, tdb_off_t rec_ptr)
TDB_DATA key, data;
memset(&data, '\0', sizeof(data));
- key.dptr = (char *)&rec_ptr;
+ key.dptr = (unsigned char *)&rec_ptr;
key.dsize = sizeof(rec_ptr);
return tdb_store(mem_tdb, key, data, TDB_INSERT);
}
diff --git a/source3/tdb/common/io.c b/source3/tdb/common/io.c
index 9a8e270dcc..cd06dbb1e3 100644
--- a/source3/tdb/common/io.c
+++ b/source3/tdb/common/io.c
@@ -332,16 +332,16 @@ int tdb_ofs_write(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d)
/* read a lump of data, allocating the space for it */
-char *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t len)
+unsigned char *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t len)
{
- char *buf;
+ unsigned char *buf;
/* some systems don't like zero length malloc */
if (len == 0) {
len = 1;
}
- if (!(buf = (char *)malloc(len))) {
+ if (!(buf = (unsigned char *)malloc(len))) {
/* Ensure ecode is set for log fn. */
tdb->ecode = TDB_ERR_OOM;
TDB_LOG((tdb, TDB_DEBUG_ERROR,"tdb_alloc_read malloc failed len=%d (%s)\n",
@@ -376,7 +376,7 @@ int tdb_parse_data(struct tdb_context *tdb, TDB_DATA key,
if (tdb->methods->tdb_oob(tdb, offset+len, 0) != 0) {
return -1;
}
- data.dptr = offset + (char *)tdb->map_ptr;
+ data.dptr = offset + (unsigned char *)tdb->map_ptr;
return parser(key, data, private_data);
}
diff --git a/source3/tdb/common/tdb.c b/source3/tdb/common/tdb.c
index bf43701d2e..25103d826e 100644
--- a/source3/tdb/common/tdb.c
+++ b/source3/tdb/common/tdb.c
@@ -564,10 +564,10 @@ int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf)
dbuf = tdb_fetch(tdb, key);
if (dbuf.dptr == NULL) {
- dbuf.dptr = (char *)malloc(new_dbuf.dsize);
+ dbuf.dptr = (unsigned char *)malloc(new_dbuf.dsize);
} else {
- dbuf.dptr = (char *)realloc(dbuf.dptr,
- dbuf.dsize + new_dbuf.dsize);
+ dbuf.dptr = (unsigned char *)realloc(dbuf.dptr,
+ dbuf.dsize + new_dbuf.dsize);
}
if (dbuf.dptr == NULL) {
diff --git a/source3/tdb/common/tdb_private.h b/source3/tdb/common/tdb_private.h
index 10bc6dacdc..9d39de0200 100644
--- a/source3/tdb/common/tdb_private.h
+++ b/source3/tdb/common/tdb_private.h
@@ -196,7 +196,7 @@ int tdb_unlock_record(struct tdb_context *tdb, tdb_off_t off);
int tdb_rec_read(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec);
int tdb_rec_write(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec);
int tdb_do_delete(struct tdb_context *tdb, tdb_off_t rec_ptr, struct list_struct *rec);
-char *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t len);
+unsigned char *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t len);
int tdb_parse_data(struct tdb_context *tdb, TDB_DATA key,
tdb_off_t offset, tdb_len_t len,
int (*parser)(TDB_DATA key, TDB_DATA data,
diff --git a/source3/tdb/common/traverse.c b/source3/tdb/common/traverse.c
index 6d3b111479..fb2371d403 100644
--- a/source3/tdb/common/traverse.c
+++ b/source3/tdb/common/traverse.c
@@ -279,7 +279,7 @@ TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA oldkey)
u32 oldhash;
TDB_DATA key = tdb_null;
struct list_struct rec;
- char *k = NULL;
+ unsigned char *k = NULL;
/* Is locked key the old key? If so, traverse will be reliable. */
if (tdb->travlocks.off) {
diff --git a/source3/tdb/include/tdb.h b/source3/tdb/include/tdb.h
index 51bf709f44..dafe2a130e 100644
--- a/source3/tdb/include/tdb.h
+++ b/source3/tdb/include/tdb.h
@@ -60,7 +60,7 @@ enum tdb_debug_level {TDB_DEBUG_FATAL = 0, TDB_DEBUG_ERROR,
TDB_DEBUG_WARNING, TDB_DEBUG_TRACE};
typedef struct TDB_DATA {
- char *dptr;
+ unsigned char *dptr;
size_t dsize;
} TDB_DATA;
diff --git a/source3/tdb/tools/tdbdump.c b/source3/tdb/tools/tdbdump.c
index b702fb0735..2ff2a2b019 100644
--- a/source3/tdb/tools/tdbdump.c
+++ b/source3/tdb/tools/tdbdump.c
@@ -73,7 +73,7 @@ static int dump_tdb(const char *fname, const char *keyname)
if (!keyname) {
tdb_traverse(tdb, traverse_fn, NULL);
} else {
- key.dptr = (char *)keyname;
+ key.dptr = (unsigned char *)keyname;
key.dsize = strlen( keyname);
value = tdb_fetch(tdb, key);
if (!value.dptr) {
diff --git a/source3/tdb/tools/tdbtool.c b/source3/tdb/tools/tdbtool.c
index bcfb96adc0..137675a88f 100644
--- a/source3/tdb/tools/tdbtool.c
+++ b/source3/tdb/tools/tdbtool.c
@@ -237,9 +237,9 @@ static void insert_tdb(char *keyname, size_t keylen, char* data, size_t datalen)
return;
}
- key.dptr = keyname;
+ key.dptr = (unsigned char *)keyname;
key.dsize = keylen;
- dbuf.dptr = data;
+ dbuf.dptr = (unsigned char *)data;
dbuf.dsize = datalen;
if (tdb_store(tdb, key, dbuf, TDB_INSERT) == -1) {
@@ -261,9 +261,9 @@ static void store_tdb(char *keyname, size_t keylen, char* data, size_t datalen)
return;
}
- key.dptr = keyname;
+ key.dptr = (unsigned char *)keyname;
key.dsize = keylen;
- dbuf.dptr = data;
+ dbuf.dptr = (unsigned char *)data;
dbuf.dsize = datalen;
printf("Storing key:\n");
@@ -283,7 +283,7 @@ static void show_tdb(char *keyname, size_t keylen)
return;
}
- key.dptr = keyname;
+ key.dptr = (unsigned char *)keyname;
key.dsize = keylen;
dbuf = tdb_fetch(tdb, key);
@@ -308,7 +308,7 @@ static void delete_tdb(char *keyname, size_t keylen)
return;
}
- key.dptr = keyname;
+ key.dptr = (unsigned char *)keyname;
key.dsize = keylen;
if (tdb_delete(tdb, key) != 0) {
@@ -331,7 +331,7 @@ static void move_rec(char *keyname, size_t keylen, char* tdbname)
return;
}
- key.dptr = keyname;
+ key.dptr = (unsigned char *)keyname;
key.dsize = keylen;
dbuf = tdb_fetch(tdb, key);
@@ -404,16 +404,16 @@ static int print_crec(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *s
static int print_arec(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
{
printf("\nkey %d bytes\n", (int)key.dsize);
- print_asc(key.dptr, key.dsize);
+ print_asc((const char *)key.dptr, key.dsize);
printf("\ndata %d bytes\n", (int)dbuf.dsize);
- print_data(dbuf.dptr, dbuf.dsize);
+ print_data((const char *)dbuf.dptr, dbuf.dsize);
return 0;
}
static int print_key(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
{
printf("key %d bytes: ", (int)key.dsize);
- print_asc(key.dptr, key.dsize);
+ print_asc((const char *)key.dptr, key.dsize);
printf("\n");
return 0;
}
@@ -421,7 +421,7 @@ static int print_key(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *st
static int print_hexkey(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
{
printf("key %d bytes\n", (int)key.dsize);
- print_data(key.dptr, key.dsize);
+ print_data((const char *)key.dptr, key.dsize);
printf("\n");
return 0;
}
diff --git a/source3/torture/mangle_test.c b/source3/torture/mangle_test.c
index 1c9fba355a..1330477cc5 100644
--- a/source3/torture/mangle_test.c
+++ b/source3/torture/mangle_test.c
@@ -87,7 +87,7 @@ static BOOL test_one(struct cli_state *cli, const char *name)
data = tdb_fetch_bystring(tdb, shortname);
if (data.dptr) {
/* maybe its a duplicate long name? */
- if (!strequal(name, data.dptr)) {
+ if (!strequal(name, (const char *)data.dptr)) {
/* we have a collision */
collisions++;
printf("Collision between %s and %s -> %s "
@@ -98,7 +98,7 @@ static BOOL test_one(struct cli_state *cli, const char *name)
} else {
TDB_DATA namedata;
/* store it for later */
- namedata.dptr = CONST_DISCARD(char *, name);
+ namedata.dptr = CONST_DISCARD(uint8 *, name);
namedata.dsize = strlen(name)+1;
tdb_store_bystring(tdb, shortname, namedata, TDB_REPLACE);
}
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 060079a573..b08a059d02 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -887,7 +887,7 @@ static BOOL do_winbind_offline(const struct process_id pid,
for (retry = 0; retry < 5; retry++) {
TDB_DATA d;
- char buf[4];
+ uint8 buf[4];
ZERO_STRUCT(d);