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))
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;
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);
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);
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);
return NT_STATUS_OK;
}
- p = dbuf.dptr;
+ p = (const char *)dbuf.dptr;
while (next_token(&p, string_sid, " ", sizeof(string_sid))) {
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))) {
* 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. */
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,
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));
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;
}
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);
}
/* 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;
goto failed;
}
- key.dptr = (char *)key_str;
+ key.dptr = (uint8_t *)key_str;
key.dsize = strlen(key_str) + 1;
return key;
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;
}
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. */
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;
}
/* 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
{
TDB_DATA kbuf;
TDB_DATA dbuf;
- char *buf;
+ uint8 *buf;
unsigned int message_count = 0;
kbuf = message_key_pid(pid);
return False;
}
- *msgs_buf = dbuf.dptr;
+ *msgs_buf = (char *)dbuf.dptr;
*total_len = dbuf.dsize;
return True;
/* 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 );
/* 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 */
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) */
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);
}
/****************************************************************************
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);
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)
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;
int len;
char *s;
char c;
- char *buf0 = buf;
+ uint8 *buf0 = buf;
const char *fmt0 = fmt;
int bufsize0 = bufsize;
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;
}
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) {
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;
void **p;
char *s, **b;
char c;
- char *buf0 = buf;
+ const uint8 *buf0 = buf;
const char *fmt0 = fmt;
int bufsize0 = bufsize;
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);
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");
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;
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 );
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;
}
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);
}
/* 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);
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) {
}
/* 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);
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);
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) ||
}
if (orig_num_locks != num_locks) {
- dbuf.dptr = (char *)locks;
+ dbuf.dptr = (uint8 *)locks;
dbuf.dsize = num_locks * sizeof(*locks);
if (dbuf.dsize) {
{
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) {
}
} 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) {
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) {
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;
}
/* 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));
}
/* 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 );
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 +
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");
/* 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);
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) {
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;
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;
}
key.device = dev;
key.inode = inode;
key.r = 'r';
- kbuf.dptr = (char *)&key;
+ kbuf.dptr = (uint8 *)&key;
kbuf.dsize = sizeof(key);
return kbuf;
}
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");
}
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");
}
}
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);
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;
}
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;
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;
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;
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;
}
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;
}
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:
}
/* 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;
}
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);
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);
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;
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) {
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;
/* 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 */
}
}
{
TDB_DATA data;
fstring key_str;
- char buf[8];
+ uint8 buf[8];
if (!wcache->tdb) {
DEBUG(10,("store_cache_seqnum: tdb == NULL\n"));
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);
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;
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;
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;
{
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);
}
{
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;
{
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) {
/* save a copy of the key */
- fstrcpy(cred->name, kbuf.dptr);
+ fstrcpy(cred->name, (const char *)kbuf.dptr);
DLIST_ADD(wcache_cred_list, cred);
}
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);
}
}
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;
/* 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 */
}
/* 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 */
/* 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 */
/* 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 */
/* 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 */
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);
/* 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 );
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) {
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"));
/* 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 */
/* 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();
goto done;
}
- fstrcpy(name, data.dptr);
+ fstrcpy(name, (const char *)data.dptr);
SAFE_FREE(data.dptr);
nt_status = tdbsam_getsampwnam (my_methods, user, name);
ret = False;
goto done;
}
- data.dptr = (char *)buf;
+ data.dptr = buf;
fstrcpy(name, pdb_get_username(newpwd));
strlower_m(name);
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;
}
*
* @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;
*
* @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;
*
* @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;
*
* @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;
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;
/* 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);
}
/* 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;
/* 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"));
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 */
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;
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;
struct notify_queue *next, *prev;
struct spoolss_notify_msg *msg;
struct timeval tv;
- char *buf;
+ uint8 *buf;
size_t buflen;
} *notify_queue_head = NULL;
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:
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;
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);
}
}
- 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);
}
}
- 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);
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;
}
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;
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 );
/* 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 */
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);
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;
}
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) {
return -1;
}
- fstrcpy((*list)[total], kbuf.dptr+strlen(key));
+ fstrcpy((*list)[total], (const char *)kbuf.dptr+strlen(key));
total++;
}
pstring directory;
fstring temp_name;
pstring key;
- char *buf;
+ uint8 *buf;
int i, ret;
TDB_DATA dbuf;
}
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;
/****************************************************************************
****************************************************************************/
-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;
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;
****************************************************************************/
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;
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;
/****************************************************************************
****************************************************************************/
-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;
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;
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;
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;
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);
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);
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) )
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);
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);
TDB_DATA ret;
SIVAL(&j, 0, jobid);
- ret.dptr = (char *)&j;
+ ret.dptr = (uint8 *)&j;
ret.dsize = sizeof(j);
return ret;
}
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;
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;
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;
}
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);
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;
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);
int printing_type;
size_t len;
- len = tdb_unpack( (char *)buf, msglen, "fdPP",
+ len = tdb_unpack( buf, msglen, "fdPP",
sharename,
&printing_type,
lpqcommand,
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;
lpqcommand,
lprmcommand );
- buffer = SMB_XMALLOC_ARRAY( char, len );
+ buffer = SMB_XMALLOC_ARRAY( uint8, len );
/* now pack the buffer */
newlen = tdb_pack( buffer, len, "fdPP",
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));
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 ));
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;
/* allocate some initial memory */
- if (!(buffer = (char *)SMB_MALLOC(sizeof(pstring)))) {
+ if (!(buffer = (uint8 *)SMB_MALLOC(sizeof(pstring)))) {
return False;
}
buflen = sizeof(pstring);
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;
pstring path;
uint32 num_items;
TDB_DATA dbuf;
- char *buf;
+ uint8 *buf;
uint32 buflen, len;
int i;
fstring subkeyname;
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;
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;
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 );
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 */
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);
}
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;
}
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,
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 );
}
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,
/* 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)); */
key.dsize = sizeof( int32 );
srecno = recno;
- key.dptr = ( char * ) &srecno;
+ key.dptr = ( uint8 * ) &srecno;
ret = tdb_fetch( tdb, key );
/* 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",
}
#endif
- pkbuf->dptr = (char *)pkey;
+ pkbuf->dptr = (uint8 *)pkey;
pkbuf->dsize = sizeof(*pkey);
}
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) {
goto done;
}
- data.dptr = (char*)prec;
+ data.dptr = (uint8 *)prec;
data.dsize = sizeof(struct pipe_open_rec);
if ( (pipe_tdb = conn_tdb_ctx() ) == NULL ) {
}
/* 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 );
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);
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"));
*/
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));
}
} 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 ));
{
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;
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);
}
/* 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",
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);
}
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) {
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,
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) {
TDB_DEBUG_WARNING, TDB_DEBUG_TRACE};
typedef struct TDB_DATA {
- char *dptr;
+ unsigned char *dptr;
size_t dsize;
} TDB_DATA;
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) {
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) {
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");
return;
}
- key.dptr = keyname;
+ key.dptr = (unsigned char *)keyname;
key.dsize = keylen;
dbuf = tdb_fetch(tdb, key);
return;
}
- key.dptr = keyname;
+ key.dptr = (unsigned char *)keyname;
key.dsize = keylen;
if (tdb_delete(tdb, key) != 0) {
return;
}
- key.dptr = keyname;
+ key.dptr = (unsigned char *)keyname;
key.dsize = keylen;
dbuf = tdb_fetch(tdb, key);
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;
}
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;
}
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 "
} 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);
}
for (retry = 0; retry < 5; retry++) {
TDB_DATA d;
- char buf[4];
+ uint8 buf[4];
ZERO_STRUCT(d);