diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-03-01 12:10:10 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:52:10 -0500 |
commit | 71bf8326f53949821291771a8303e48245f5c6e7 (patch) | |
tree | 5a0ff03e49826739a14beddf00af75a58df8225f /source4/lib/samba3 | |
parent | 116585c521fd0bc3c80e49c54284c9a949e68091 (diff) | |
download | samba-71bf8326f53949821291771a8303e48245f5c6e7.tar.gz samba-71bf8326f53949821291771a8303e48245f5c6e7.tar.bz2 samba-71bf8326f53949821291771a8303e48245f5c6e7.zip |
r13767: fix compiler warnings
metze
(This used to be commit 0ab3a42341bc1b44de4834adf010a0e511383bfa)
Diffstat (limited to 'source4/lib/samba3')
-rw-r--r-- | source4/lib/samba3/group.c | 17 | ||||
-rw-r--r-- | source4/lib/samba3/idmap.c | 18 | ||||
-rw-r--r-- | source4/lib/samba3/secrets.c | 30 | ||||
-rw-r--r-- | source4/lib/samba3/tdbsam.c | 2 |
4 files changed, 36 insertions, 31 deletions
diff --git a/source4/lib/samba3/group.c b/source4/lib/samba3/group.c index cf76bddffe..eea70c8530 100644 --- a/source4/lib/samba3/group.c +++ b/source4/lib/samba3/group.c @@ -74,8 +74,9 @@ NTSTATUS samba3_read_grouptdb(const char *file, TALLOC_CTX *ctx, struct samba3_g kbuf.dptr; newkey = tdb_nextkey(tdb, kbuf), safe_free(kbuf.dptr), kbuf=newkey) { struct samba3_groupmapping map; + const char *k = (const char *)kbuf.dptr; - if (strncmp(kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) == 0) + if (strncmp(k, GROUP_PREFIX, strlen(GROUP_PREFIX)) == 0) { dbuf = tdb_fetch(tdb, kbuf); if (!dbuf.dptr) @@ -83,9 +84,9 @@ NTSTATUS samba3_read_grouptdb(const char *file, TALLOC_CTX *ctx, struct samba3_g ZERO_STRUCT(map); - map.sid = dom_sid_parse_talloc(ctx, kbuf.dptr+strlen(GROUP_PREFIX)); + map.sid = dom_sid_parse_talloc(ctx, k+strlen(GROUP_PREFIX)); - ret = tdb_unpack(tdb, dbuf.dptr, dbuf.dsize, "dd", + ret = tdb_unpack(tdb, (char *)dbuf.dptr, dbuf.dsize, "dd", &map.gid, &map.sid_name_use); if ( ret == -1 ) { @@ -93,8 +94,8 @@ NTSTATUS samba3_read_grouptdb(const char *file, TALLOC_CTX *ctx, struct samba3_g continue; } - map.nt_name = talloc_strdup(ctx, dbuf.dptr+ret); - map.comment = talloc_strdup(ctx, dbuf.dptr+ret+strlen(map.nt_name)); + map.nt_name = talloc_strdup(ctx, (const char *)(dbuf.dptr+ret)); + map.comment = talloc_strdup(ctx, (const char *)(dbuf.dptr+ret+strlen(map.nt_name))); db->groupmappings = talloc_realloc(ctx, db->groupmappings, struct samba3_groupmapping, db->groupmap_count+1); @@ -104,7 +105,7 @@ NTSTATUS samba3_read_grouptdb(const char *file, TALLOC_CTX *ctx, struct samba3_g db->groupmappings[db->groupmap_count] = map; db->groupmap_count++; - } else if (strncmp(kbuf.dptr, MEMBEROF_PREFIX, strlen(MEMBEROF_PREFIX)) == 0) + } else if (strncmp(k, MEMBEROF_PREFIX, strlen(MEMBEROF_PREFIX)) == 0) { struct samba3_alias alias; const char **member_strlist; @@ -114,11 +115,11 @@ NTSTATUS samba3_read_grouptdb(const char *file, TALLOC_CTX *ctx, struct samba3_g if (!dbuf.dptr) continue; - alias.sid = dom_sid_parse_talloc(ctx, kbuf.dptr+strlen(MEMBEROF_PREFIX)); + alias.sid = dom_sid_parse_talloc(ctx, k+strlen(MEMBEROF_PREFIX)); alias.member_count = 0; alias.members = NULL; - member_strlist = str_list_make_shell(ctx, dbuf.dptr, " "); + member_strlist = str_list_make_shell(ctx, (const char *)dbuf.dptr, " "); for (i = 0; member_strlist[i]; i++) { alias.members = talloc_realloc(ctx, alias.members, struct dom_sid *, alias.member_count+1); diff --git a/source4/lib/samba3/idmap.c b/source4/lib/samba3/idmap.c index b1c7c0dcca..205089f1cc 100644 --- a/source4/lib/samba3/idmap.c +++ b/source4/lib/samba3/idmap.c @@ -58,17 +58,21 @@ NTSTATUS samba3_read_idmap(const char *fn, TALLOC_CTX *ctx, struct samba3_idmapd for (key = tdb_firstkey(tdb); key.dptr; key = tdb_nextkey(tdb, key)) { struct samba3_idmap_mapping map; - - if (strncmp(key.dptr, "GID ", 4) == 0) { + const char *k = (const char *)key.dptr; + const char *v; + + if (strncmp(k, "GID ", 4) == 0) { map.type = IDMAP_GROUP; - map.unix_id = atoi(key.dptr+4); + map.unix_id = atoi(k+4); val = tdb_fetch(tdb, key); - map.sid = dom_sid_parse_talloc(ctx, val.dptr); - } else if (strncmp(key.dptr, "UID ", 4) == 0) { + v = (const char *)val.dptr; + map.sid = dom_sid_parse_talloc(ctx, v); + } else if (strncmp(k, "UID ", 4) == 0) { map.type = IDMAP_USER; - map.unix_id = atoi(key.dptr+4); + map.unix_id = atoi(k+4); val = tdb_fetch(tdb, key); - map.sid = dom_sid_parse_talloc(ctx, val.dptr); + v = (const char *)val.dptr; + map.sid = dom_sid_parse_talloc(ctx, v); } else { continue; } diff --git a/source4/lib/samba3/secrets.c b/source4/lib/samba3/secrets.c index 953e00d367..33992a9b32 100644 --- a/source4/lib/samba3/secrets.c +++ b/source4/lib/samba3/secrets.c @@ -81,19 +81,19 @@ static struct samba3_domainsecrets *secrets_find_domain(TALLOC_CTX *ctx, struct static NTSTATUS ipc_password (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db) { - cli_credentials_set_password(db->ipc_cred, vbuf.dptr, CRED_SPECIFIED); + cli_credentials_set_password(db->ipc_cred, (const char *)vbuf.dptr, CRED_SPECIFIED); return NT_STATUS_OK; } static NTSTATUS ipc_username (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db) { - cli_credentials_set_username(db->ipc_cred, vbuf.dptr, CRED_SPECIFIED); + cli_credentials_set_username(db->ipc_cred, (const char *)vbuf.dptr, CRED_SPECIFIED); return NT_STATUS_OK; } static NTSTATUS ipc_domain (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db) { - cli_credentials_set_domain(db->ipc_cred, vbuf.dptr, CRED_SPECIFIED); + cli_credentials_set_domain(db->ipc_cred, (const char *)vbuf.dptr, CRED_SPECIFIED); return NT_STATUS_OK; } @@ -101,7 +101,7 @@ static NTSTATUS domain_sid (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TA { struct samba3_domainsecrets *domainsec = secrets_find_domain(ctx, db, key); domainsec->sid.sub_auths = talloc_array(ctx, uint32_t, 15); - tdb_sid_unpack(tdb, vbuf.dptr, vbuf.dsize, &domainsec->sid); + tdb_sid_unpack(tdb, (char *)vbuf.dptr, vbuf.dsize, &domainsec->sid); return NT_STATUS_OK; } @@ -116,7 +116,7 @@ static NTSTATUS ldap_bind_pw (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, { struct samba3_ldappw pw; pw.dn = talloc_strdup(ctx, key); - pw.password = talloc_strdup(ctx, vbuf.dptr); + pw.password = talloc_strdup(ctx, (const char *)vbuf.dptr); db->ldappws = talloc_realloc(ctx, db->ldappws, struct samba3_ldappw, db->ldappw_count+1); db->ldappws[db->ldappw_count] = pw; @@ -155,7 +155,7 @@ static NTSTATUS machine_last_change_time (TDB_CONTEXT *tdb, const char *key, TDB static NTSTATUS machine_password (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, TALLOC_CTX *ctx, struct samba3_secrets *db) { struct samba3_domainsecrets *domainsec = secrets_find_domain(ctx, db, key); - domainsec->plaintext_pw = talloc_strdup(ctx, vbuf.dptr); + domainsec->plaintext_pw = talloc_strdup(ctx, (const char *)vbuf.dptr); return NT_STATUS_OK; } @@ -184,19 +184,19 @@ static NTSTATUS domtrust_acc (TDB_CONTEXT *tdb, const char *key, TDB_DATA vbuf, return NT_STATUS_UNSUCCESSFUL; /* unpack unicode domain name and plaintext password */ - len += tdb_unpack(tdb, vbuf.dptr, vbuf.dsize - len, "d", &pass.uni_name_len); + len += tdb_unpack(tdb, (char *)vbuf.dptr, vbuf.dsize - len, "d", &pass.uni_name_len); for (idx = 0; idx < 32; idx++) - len += tdb_unpack(tdb, vbuf.dptr + len, vbuf.dsize - len, "w", &pass.uni_name[idx]); + len += tdb_unpack(tdb, (char *)(vbuf.dptr + len), vbuf.dsize - len, "w", &pass.uni_name[idx]); - len += tdb_unpack(tdb, vbuf.dptr + len, vbuf.dsize - len, "d", &pass_len); - pass.pass = talloc_strdup(ctx, vbuf.dptr+len); - len += strlen(vbuf.dptr)+1; - len += tdb_unpack(tdb, vbuf.dptr + len, vbuf.dsize - len, "d", &pass.mod_time); + len += tdb_unpack(tdb, (char *)(vbuf.dptr + len), vbuf.dsize - len, "d", &pass_len); + pass.pass = talloc_strdup(ctx, (char *)(vbuf.dptr+len)); + len += strlen((const char *)vbuf.dptr)+1; + len += tdb_unpack(tdb, (char *)(vbuf.dptr + len), vbuf.dsize - len, "d", &pass.mod_time); pass.domain_sid.sub_auths = talloc_array(ctx, uint32_t, 15); /* unpack domain sid */ - len += tdb_sid_unpack(tdb, vbuf.dptr + len, vbuf.dsize - len, &pass.domain_sid); + len += tdb_sid_unpack(tdb, (char *)(vbuf.dptr + len), vbuf.dsize - len, &pass.domain_sid); /* FIXME: Add to list */ @@ -244,8 +244,8 @@ NTSTATUS samba3_read_secrets(const char *fname, TALLOC_CTX *ctx, struct samba3_s vbuf = tdb_fetch(tdb, kbuf); for (i = 0; secrets_handlers[i].prefix; i++) { - if (!strncmp(kbuf.dptr, secrets_handlers[i].prefix, strlen(secrets_handlers[i].prefix))) { - key = talloc_strndup(ctx, kbuf.dptr+strlen(secrets_handlers[i].prefix), kbuf.dsize-strlen(secrets_handlers[i].prefix)); + if (!strncmp((const char *)kbuf.dptr, secrets_handlers[i].prefix, strlen(secrets_handlers[i].prefix))) { + key = talloc_strndup(ctx, (const char *)(kbuf.dptr+strlen(secrets_handlers[i].prefix)), kbuf.dsize-strlen(secrets_handlers[i].prefix)); secrets_handlers[i].handler(tdb, key, vbuf, ctx, db); talloc_free(key); break; diff --git a/source4/lib/samba3/tdbsam.c b/source4/lib/samba3/tdbsam.c index 5397abca49..80f1448d9c 100644 --- a/source4/lib/samba3/tdbsam.c +++ b/source4/lib/samba3/tdbsam.c @@ -235,7 +235,7 @@ NTSTATUS samba3_read_tdbsam(const char *filename, TALLOC_CTX *ctx, struct samba3 for (key = tdb_firstkey(tdb); key.dptr; key = tdb_nextkey(tdb, key)) { BOOL ret; - if (strncmp(key.dptr, "USER_", 5) != 0) + if (strncmp((const char *)key.dptr, "USER_", 5) != 0) continue; val = tdb_fetch(tdb, key); |