diff options
author | Jeremy Allison <jra@samba.org> | 2005-10-18 03:24:00 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:05:02 -0500 |
commit | 8d7c88667190fe286971ac4fffb64ee5bd9eeeb0 (patch) | |
tree | d5b2f0850d63a07e051c03a7abe1f10884598161 /source3/passdb | |
parent | afca439d19e3d9e67b127d7060df630e2218bcb2 (diff) | |
download | samba-8d7c88667190fe286971ac4fffb64ee5bd9eeeb0.tar.gz samba-8d7c88667190fe286971ac4fffb64ee5bd9eeeb0.tar.bz2 samba-8d7c88667190fe286971ac4fffb64ee5bd9eeeb0.zip |
r11137: Compile with only 2 warnings (I'm still working on that code) on a gcc4
x86_64 box.
Jeremy.
(This used to be commit d720867a788c735e56d53d63265255830ec21208)
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/pdb_interface.c | 119 | ||||
-rw-r--r-- | source3/passdb/pdb_ldap.c | 104 | ||||
-rw-r--r-- | source3/passdb/pdb_nds.c | 2 | ||||
-rw-r--r-- | source3/passdb/pdb_sql.c | 2 |
4 files changed, 114 insertions, 113 deletions
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index 485f405568..482f3e3c9b 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -491,7 +491,7 @@ static NTSTATUS context_delete_group_mapping_entry(struct pdb_context *context, static NTSTATUS context_enum_group_mapping(struct pdb_context *context, enum SID_NAME_USE sid_name_use, - GROUP_MAP **rmap, int *num_entries, + GROUP_MAP **pp_rmap, size_t *p_num_entries, BOOL unix_only) { NTSTATUS ret = NT_STATUS_UNSUCCESSFUL; @@ -502,15 +502,15 @@ static NTSTATUS context_enum_group_mapping(struct pdb_context *context, } return context->pdb_methods->enum_group_mapping(context->pdb_methods, - sid_name_use, rmap, - num_entries, unix_only); + sid_name_use, pp_rmap, + p_num_entries, unix_only); } static NTSTATUS context_enum_group_members(struct pdb_context *context, TALLOC_CTX *mem_ctx, const DOM_SID *group, - uint32 **member_rids, - int *num_members) + uint32 **pp_member_rids, + size_t *p_num_members) { NTSTATUS ret = NT_STATUS_UNSUCCESSFUL; @@ -521,15 +521,15 @@ static NTSTATUS context_enum_group_members(struct pdb_context *context, return context->pdb_methods->enum_group_members(context->pdb_methods, mem_ctx, group, - member_rids, - num_members); + pp_member_rids, + p_num_members); } static NTSTATUS context_enum_group_memberships(struct pdb_context *context, const char *username, gid_t primary_gid, - DOM_SID **sids, gid_t **gids, - int *num_groups) + DOM_SID **pp_sids, gid_t **pp_gids, + size_t *p_num_groups) { NTSTATUS ret = NT_STATUS_UNSUCCESSFUL; @@ -540,7 +540,7 @@ static NTSTATUS context_enum_group_memberships(struct pdb_context *context, return context->pdb_methods-> enum_group_memberships(context->pdb_methods, username, - primary_gid, sids, gids, num_groups); + primary_gid, pp_sids, pp_gids, p_num_groups); } static NTSTATUS context_find_alias(struct pdb_context *context, @@ -645,8 +645,8 @@ static NTSTATUS context_del_aliasmem(struct pdb_context *context, } static NTSTATUS context_enum_aliasmem(struct pdb_context *context, - const DOM_SID *alias, DOM_SID **members, - int *num) + const DOM_SID *alias, DOM_SID **pp_members, + size_t *p_num) { NTSTATUS ret = NT_STATUS_UNSUCCESSFUL; @@ -656,16 +656,16 @@ static NTSTATUS context_enum_aliasmem(struct pdb_context *context, } return context->pdb_methods->enum_aliasmem(context->pdb_methods, - alias, members, num); + alias, pp_members, p_num); } static NTSTATUS context_enum_alias_memberships(struct pdb_context *context, TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid, const DOM_SID *members, - int num_members, - uint32 **alias_rids, - int *num_alias_rids) + size_t num_members, + uint32 **pp_alias_rids, + size_t *p_num_alias_rids) { NTSTATUS ret = NT_STATUS_UNSUCCESSFUL; @@ -677,16 +677,16 @@ static NTSTATUS context_enum_alias_memberships(struct pdb_context *context, return context->pdb_methods-> enum_alias_memberships(context->pdb_methods, mem_ctx, domain_sid, members, num_members, - alias_rids, num_alias_rids); + pp_alias_rids, p_num_alias_rids); } static NTSTATUS context_lookup_rids(struct pdb_context *context, TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid, - int num_rids, + size_t num_rids, uint32 *rids, - const char ***names, - uint32 **attrs) + const char ***pp_names, + uint32 **pp_attrs) { NTSTATUS ret = NT_STATUS_UNSUCCESSFUL; @@ -697,7 +697,7 @@ static NTSTATUS context_lookup_rids(struct pdb_context *context, return context->pdb_methods->lookup_rids(context->pdb_methods, mem_ctx, domain_sid, num_rids, - rids, names, attrs); + rids, pp_names, pp_attrs); } static NTSTATUS context_get_account_policy(struct pdb_context *context, @@ -1238,8 +1238,8 @@ BOOL pdb_delete_group_mapping_entry(DOM_SID sid) pdb_delete_group_mapping_entry(pdb_context, sid)); } -BOOL pdb_enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap, - int *num_entries, BOOL unix_only) +BOOL pdb_enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **pp_rmap, + size_t *p_num_entries, BOOL unix_only) { struct pdb_context *pdb_context = pdb_get_static_context(False); @@ -1249,13 +1249,13 @@ BOOL pdb_enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap, return NT_STATUS_IS_OK(pdb_context-> pdb_enum_group_mapping(pdb_context, sid_name_use, - rmap, num_entries, unix_only)); + pp_rmap, p_num_entries, unix_only)); } NTSTATUS pdb_enum_group_members(TALLOC_CTX *mem_ctx, const DOM_SID *sid, - uint32 **member_rids, - int *num_members) + uint32 **pp_member_rids, + size_t *p_num_members) { struct pdb_context *pdb_context = pdb_get_static_context(False); @@ -1264,12 +1264,12 @@ NTSTATUS pdb_enum_group_members(TALLOC_CTX *mem_ctx, } return pdb_context->pdb_enum_group_members(pdb_context, mem_ctx, sid, - member_rids, num_members); + pp_member_rids, p_num_members); } NTSTATUS pdb_enum_group_memberships(const char *username, gid_t primary_gid, - DOM_SID **sids, gid_t **gids, - int *num_groups) + DOM_SID **pp_sids, gid_t **pp_gids, + size_t *p_num_groups) { struct pdb_context *pdb_context = pdb_get_static_context(False); @@ -1278,8 +1278,8 @@ NTSTATUS pdb_enum_group_memberships(const char *username, gid_t primary_gid, } return pdb_context->pdb_enum_group_memberships(pdb_context, username, - primary_gid, sids, gids, - num_groups); + primary_gid, pp_sids, pp_gids, + p_num_groups); } BOOL pdb_find_alias(const char *name, DOM_SID *sid) @@ -1367,7 +1367,7 @@ BOOL pdb_del_aliasmem(const DOM_SID *alias, const DOM_SID *member) } BOOL pdb_enum_aliasmem(const DOM_SID *alias, - DOM_SID **members, int *num_members) + DOM_SID **pp_members, size_t *p_num_members) { struct pdb_context *pdb_context = pdb_get_static_context(False); @@ -1377,12 +1377,12 @@ BOOL pdb_enum_aliasmem(const DOM_SID *alias, return NT_STATUS_IS_OK(pdb_context-> pdb_enum_aliasmem(pdb_context, alias, - members, num_members)); + pp_members, p_num_members)); } BOOL pdb_enum_alias_memberships(TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid, - const DOM_SID *members, int num_members, - uint32 **alias_rids, int *num_alias_rids) + const DOM_SID *members, size_t num_members, + uint32 **pp_alias_rids, size_t *p_num_alias_rids) { struct pdb_context *pdb_context = pdb_get_static_context(False); @@ -1394,8 +1394,8 @@ BOOL pdb_enum_alias_memberships(TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid, pdb_enum_alias_memberships(pdb_context, mem_ctx, domain_sid, members, num_members, - alias_rids, - num_alias_rids)); + pp_alias_rids, + p_num_alias_rids)); } NTSTATUS pdb_lookup_rids(TALLOC_CTX *mem_ctx, @@ -1534,33 +1534,32 @@ static NTSTATUS pdb_default_get_seq_num(struct pdb_methods *methods, time_t *seq } static void add_uid_to_array_unique(TALLOC_CTX *mem_ctx, - uid_t uid, uid_t **uids, int *num) + uid_t uid, uid_t **pp_uids, size_t *p_num) { - int i; + size_t i; - for (i=0; i<*num; i++) { - if ((*uids)[i] == uid) + for (i=0; i<*p_num; i++) { + if ((*pp_uids)[i] == uid) return; } - *uids = TALLOC_REALLOC_ARRAY(mem_ctx, *uids, uid_t, *num+1); + *pp_uids = TALLOC_REALLOC_ARRAY(mem_ctx, *pp_uids, uid_t, *p_num+1); - if (*uids == NULL) + if (*pp_uids == NULL) return; - (*uids)[*num] = uid; - *num += 1; + (*pp_uids)[*p_num] = uid; + *p_num += 1; } -static BOOL get_memberuids(TALLOC_CTX *mem_ctx, gid_t gid, uid_t **uids, - int *num) +static BOOL get_memberuids(TALLOC_CTX *mem_ctx, gid_t gid, uid_t **pp_uids, size_t *p_num) { struct group *grp; char **gr; struct sys_pwent *userlist, *user; - *uids = NULL; - *num = 0; + *pp_uids = NULL; + *p_num = 0; /* We only look at our own sam, so don't care about imported stuff */ @@ -1578,7 +1577,7 @@ static BOOL get_memberuids(TALLOC_CTX *mem_ctx, gid_t gid, uid_t **uids, for (user = userlist; user != NULL; user = user->next) { if (user->pw_gid != gid) continue; - add_uid_to_array_unique(mem_ctx, user->pw_uid, uids, num); + add_uid_to_array_unique(mem_ctx, user->pw_uid, pp_uids, p_num); } pwent_free(userlist); @@ -1590,7 +1589,7 @@ static BOOL get_memberuids(TALLOC_CTX *mem_ctx, gid_t gid, uid_t **uids, if (pw == NULL) continue; - add_uid_to_array_unique(mem_ctx, pw->pw_uid, uids, num); + add_uid_to_array_unique(mem_ctx, pw->pw_uid, pp_uids, p_num); } winbind_on(); @@ -1601,15 +1600,15 @@ static BOOL get_memberuids(TALLOC_CTX *mem_ctx, gid_t gid, uid_t **uids, NTSTATUS pdb_default_enum_group_members(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, const DOM_SID *group, - uint32 **member_rids, - int *num_members) + uint32 **pp_member_rids, + size_t *p_num_members) { gid_t gid; uid_t *uids; - int i, num_uids; + size_t i, num_uids; - *member_rids = NULL; - *num_members = 0; + *pp_member_rids = NULL; + *p_num_members = 0; if (!NT_STATUS_IS_OK(sid_to_gid(group, &gid))) return NT_STATUS_NO_SUCH_GROUP; @@ -1620,7 +1619,7 @@ NTSTATUS pdb_default_enum_group_members(struct pdb_methods *methods, if (num_uids == 0) return NT_STATUS_OK; - *member_rids = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_uids); + *pp_member_rids = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_uids); for (i=0; i<num_uids; i++) { DOM_SID sid; @@ -1636,8 +1635,8 @@ NTSTATUS pdb_default_enum_group_members(struct pdb_methods *methods, continue; } - sid_peek_rid(&sid, &(*member_rids)[*num_members]); - *num_members += 1; + sid_peek_rid(&sid, &(*pp_member_rids)[*p_num_members]); + *p_num_members += 1; } return NT_STATUS_OK; @@ -1838,7 +1837,7 @@ static BOOL pdb_default_search_users(struct pdb_methods *methods, struct group_search { GROUP_MAP *groups; - int num_groups, current_group; + size_t num_groups, current_group; }; static BOOL next_entry_groups(struct pdb_search *s, diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index e44ccc3bf9..ea21a03b51 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -2332,22 +2332,22 @@ static NTSTATUS ldapsam_getgrnam(struct pdb_methods *methods, GROUP_MAP *map, } static void add_rid_to_array_unique(TALLOC_CTX *mem_ctx, - uint32 rid, uint32 **rids, int *num) + uint32 rid, uint32 **pp_rids, size_t *p_num) { - int i; + size_t i; - for (i=0; i<*num; i++) { - if ((*rids)[i] == rid) + for (i=0; i<*p_num; i++) { + if ((*pp_rids)[i] == rid) return; } - *rids = TALLOC_REALLOC_ARRAY(mem_ctx, *rids, uint32, *num+1); + *pp_rids = TALLOC_REALLOC_ARRAY(mem_ctx, *pp_rids, uint32, *p_num+1); - if (*rids == NULL) + if (*pp_rids == NULL) return; - (*rids)[*num] = rid; - *num += 1; + (*pp_rids)[*p_num] = rid; + *p_num += 1; } static BOOL ldapsam_extract_rid_from_entry(LDAP *ldap_struct, @@ -2386,8 +2386,8 @@ static BOOL ldapsam_extract_rid_from_entry(LDAP *ldap_struct, static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, const DOM_SID *group, - uint32 **member_rids, - int *num_members) + uint32 **pp_member_rids, + size_t *p_num_members) { struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)methods->private_data; @@ -2404,11 +2404,11 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods, if (!lp_parm_bool(-1, "ldapsam", "trusted", False)) return pdb_default_enum_group_members(methods, mem_ctx, group, - member_rids, - num_members); + pp_member_rids, + p_num_members); - *member_rids = NULL; - *num_members = 0; + *pp_member_rids = NULL; + *p_num_members = 0; pstr_sprintf(filter, "(&(objectClass=sambaSamAccount)" @@ -2439,8 +2439,8 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods, continue; } - add_rid_to_array_unique(mem_ctx, rid, member_rids, - num_members); + add_rid_to_array_unique(mem_ctx, rid, pp_member_rids, + p_num_members); } if (msg != NULL) @@ -2543,8 +2543,8 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods, sid_peek_rid(&sid, &rid); - add_rid_to_array_unique(mem_ctx, rid, member_rids, - num_members); + add_rid_to_array_unique(mem_ctx, rid, pp_member_rids, + p_num_members); } result = NT_STATUS_OK; @@ -2564,8 +2564,8 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods, static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods, const char *username, gid_t primary_gid, - DOM_SID **sids, gid_t **gids, - int *num_groups) + DOM_SID **pp_sids, gid_t **pp_gids, + size_t *p_num_groups) { struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)methods->private_data; @@ -2577,14 +2577,14 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods, LDAPMessage *msg = NULL; LDAPMessage *entry; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - int num_sids, num_gids; + size_t num_sids, num_gids; if (!lp_parm_bool(-1, "ldapsam", "trusted", False)) return pdb_default_enum_group_memberships(methods, username, - primary_gid, sids, - gids, num_groups); + primary_gid, pp_sids, + pp_gids, p_num_groups); - *sids = NULL; + *pp_sids = NULL; num_sids = 0; escape_name = escape_ldap_string_alloc(username); @@ -2603,18 +2603,18 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods, goto done; num_gids = 0; - *gids = NULL; + *pp_gids = NULL; num_sids = 0; - *sids = NULL; + *pp_sids = NULL; /* We need to add the primary group as the first gid/sid */ - add_gid_to_array_unique(NULL, primary_gid, gids, &num_gids); + add_gid_to_array_unique(NULL, primary_gid, pp_gids, &num_gids); /* This sid will be replaced later */ - add_sid_to_array_unique(NULL, &global_sid_NULL, sids, &num_sids); + add_sid_to_array_unique(NULL, &global_sid_NULL, pp_sids, &num_sids); for (entry = ldap_first_entry(conn->ldap_struct, msg); entry != NULL; @@ -2644,19 +2644,19 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods, goto done; if (gid == primary_gid) { - sid_copy(&(*sids)[0], &sid); + sid_copy(&(*pp_sids)[0], &sid); } else { - add_gid_to_array_unique(NULL, gid, gids, &num_gids); - add_sid_to_array_unique(NULL, &sid, sids, &num_sids); + add_gid_to_array_unique(NULL, gid, pp_gids, &num_gids); + add_sid_to_array_unique(NULL, &sid, pp_sids, &num_sids); } } - if (sid_compare(&global_sid_NULL, &(*sids)[0]) == 0) { + if (sid_compare(&global_sid_NULL, &(*pp_sids)[0]) == 0) { DEBUG(3, ("primary group of [%s] not found\n", username)); goto done; } - *num_groups = num_sids; + *p_num_groups = num_sids; result = NT_STATUS_OK; @@ -2979,15 +2979,15 @@ static NTSTATUS ldapsam_getsamgrent(struct pdb_methods *my_methods, static NTSTATUS ldapsam_enum_group_mapping(struct pdb_methods *methods, enum SID_NAME_USE sid_name_use, - GROUP_MAP **rmap, int *num_entries, + GROUP_MAP **pp_rmap, size_t *p_num_entries, BOOL unix_only) { GROUP_MAP map; GROUP_MAP *mapt; - int entries = 0; + size_t entries = 0; - *num_entries = 0; - *rmap = NULL; + *p_num_entries = 0; + *pp_rmap = NULL; if (!NT_STATUS_IS_OK(ldapsam_setsamgrent(methods, False))) { DEBUG(0, ("ldapsam_enum_group_mapping: Unable to open passdb\n")); @@ -3005,14 +3005,14 @@ static NTSTATUS ldapsam_enum_group_mapping(struct pdb_methods *methods, continue; } - mapt=SMB_REALLOC_ARRAY((*rmap), GROUP_MAP, entries+1); + mapt=SMB_REALLOC_ARRAY((*pp_rmap), GROUP_MAP, entries+1); if (!mapt) { DEBUG(0,("ldapsam_enum_group_mapping: Unable to enlarge group map!\n")); - SAFE_FREE(*rmap); + SAFE_FREE(*pp_rmap); return NT_STATUS_UNSUCCESSFUL; } else - (*rmap) = mapt; + (*pp_rmap) = mapt; mapt[entries] = map; @@ -3021,7 +3021,7 @@ static NTSTATUS ldapsam_enum_group_mapping(struct pdb_methods *methods, } ldapsam_endsamgrent(methods); - *num_entries = entries; + *p_num_entries = entries; return NT_STATUS_OK; } @@ -3126,8 +3126,8 @@ static NTSTATUS ldapsam_del_aliasmem(struct pdb_methods *methods, } static NTSTATUS ldapsam_enum_aliasmem(struct pdb_methods *methods, - const DOM_SID *alias, DOM_SID **members, - int *num_members) + const DOM_SID *alias, DOM_SID **pp_members, + size_t *p_num_members) { struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)methods->private_data; @@ -3137,9 +3137,10 @@ static NTSTATUS ldapsam_enum_aliasmem(struct pdb_methods *methods, char **values; int i; pstring filter; + size_t num_members; - *members = NULL; - *num_members = 0; + *pp_members = NULL; + *p_num_members = 0; pstr_sprintf(filter, "(&(|(objectClass=%s)(objectclass=%s))(%s=%s))", LDAP_OBJ_GROUPMAP, LDAP_OBJ_IDMAP_ENTRY, @@ -3193,9 +3194,10 @@ static NTSTATUS ldapsam_enum_aliasmem(struct pdb_methods *methods, if (!string_to_sid(&member, values[i])) continue; - add_sid_to_array(NULL, &member, members, num_members); + add_sid_to_array(NULL, &member, pp_members, &num_members); } + *p_num_members = num_members; ldap_value_free(values); ldap_msgfree(result); @@ -3206,9 +3208,9 @@ static NTSTATUS ldapsam_alias_memberships(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid, const DOM_SID *members, - int num_members, - uint32 **alias_rids, - int *num_alias_rids) + size_t num_members, + uint32 **pp_alias_rids, + size_t *p_num_alias_rids) { struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)methods->private_data; @@ -3265,8 +3267,8 @@ static NTSTATUS ldapsam_alias_memberships(struct pdb_methods *methods, if (!sid_peek_check_rid(domain_sid, &sid, &rid)) continue; - add_rid_to_array_unique(mem_ctx, rid, alias_rids, - num_alias_rids); + add_rid_to_array_unique(mem_ctx, rid, pp_alias_rids, + p_num_alias_rids); } ldap_msgfree(result); diff --git a/source3/passdb/pdb_nds.c b/source3/passdb/pdb_nds.c index 599a198c5a..5de80a827f 100644 --- a/source3/passdb/pdb_nds.c +++ b/source3/passdb/pdb_nds.c @@ -669,7 +669,7 @@ int pdb_nds_get_password( LDAP *ld = ldap_state->ldap_struct; int rc = -1; - rc = nmasldap_get_password(ld, object_dn, pwd_len, pwd); + rc = nmasldap_get_password(ld, object_dn, pwd_len, (unsigned char *)pwd); if (rc == LDAP_SUCCESS) { #ifdef DEBUG_PASSWORD DEBUG(100,("nmasldap_get_password returned %s for %s\n", pwd, object_dn)); diff --git a/source3/passdb/pdb_sql.c b/source3/passdb/pdb_sql.c index 3cf34df812..f52888bfa9 100644 --- a/source3/passdb/pdb_sql.c +++ b/source3/passdb/pdb_sql.c @@ -526,7 +526,7 @@ char *sql_account_query_update(TALLOC_CTX *mem_ctx, const char *location, const config_value_write(location, "logon hours column", CONFIG_LOGON_HOURS), - pdb_get_hours(newpwd)); + (const char *)pdb_get_hours(newpwd)); } if (!some_field_affected) { |