diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-03-29 09:35:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:19:00 -0500 |
commit | bc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478 (patch) | |
tree | 45124e070043ee0fd3774d74b4cfdcf1c8919c27 /source3/passdb | |
parent | b9461058d59f8e4f4b69c31592bd12a179b2d8ac (diff) | |
download | samba-bc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478.tar.gz samba-bc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478.tar.bz2 samba-bc2b6436d0f5f3e9ffdfaeb7f1b32996a83d5478.zip |
r22009: change TDB_DATA from char * to unsigned char *
and fix all compiler warnings in the users
metze
(This used to be commit 3a28443079c141a6ce8182c65b56ca210e34f37f)
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/login_cache.c | 2 | ||||
-rw-r--r-- | source3/passdb/passdb.c | 4 | ||||
-rw-r--r-- | source3/passdb/pdb_tdb.c | 23 | ||||
-rw-r--r-- | source3/passdb/secrets.c | 26 |
4 files changed, 28 insertions, 27 deletions
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; |