summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-10-18 03:24:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:02 -0500
commit8d7c88667190fe286971ac4fffb64ee5bd9eeeb0 (patch)
treed5b2f0850d63a07e051c03a7abe1f10884598161 /source3/nsswitch
parentafca439d19e3d9e67b127d7060df630e2218bcb2 (diff)
downloadsamba-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/nsswitch')
-rw-r--r--source3/nsswitch/wb_common.c3
-rw-r--r--source3/nsswitch/winbindd_ads.c30
-rw-r--r--source3/nsswitch/winbindd_async.c40
-rw-r--r--source3/nsswitch/winbindd_cache.c2
-rw-r--r--source3/nsswitch/winbindd_group.c26
-rw-r--r--source3/nsswitch/winbindd_nss.h4
-rw-r--r--source3/nsswitch/winbindd_passdb.c30
7 files changed, 71 insertions, 64 deletions
diff --git a/source3/nsswitch/wb_common.c b/source3/nsswitch/wb_common.c
index 5521614965..0e20927941 100644
--- a/source3/nsswitch/wb_common.c
+++ b/source3/nsswitch/wb_common.c
@@ -234,7 +234,8 @@ static int winbind_named_pipe_sock(const char *dir)
struct timeval tv;
fd_set w_fds;
int ret;
- int connect_errno = 0, errnosize;
+ int connect_errno = 0;
+ socklen_t errnosize;
if (wait_time >= CONNECT_TIMEOUT)
goto error_out;
diff --git a/source3/nsswitch/winbindd_ads.c b/source3/nsswitch/winbindd_ads.c
index dfabccd419..f11f151428 100644
--- a/source3/nsswitch/winbindd_ads.c
+++ b/source3/nsswitch/winbindd_ads.c
@@ -1,4 +1,4 @@
-/*
+/*
Unix SMB/CIFS implementation.
Winbind ADS backend functions
@@ -456,7 +456,7 @@ static NTSTATUS lookup_usergroups_alt(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const char *user_dn,
DOM_SID *primary_group,
- uint32 *num_groups, DOM_SID **user_sids)
+ size_t *p_num_groups, DOM_SID **user_sids)
{
ADS_STATUS rc;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
@@ -467,6 +467,7 @@ static NTSTATUS lookup_usergroups_alt(struct winbindd_domain *domain,
ADS_STRUCT *ads;
const char *group_attrs[] = {"objectSid", NULL};
char *escaped_dn;
+ size_t num_groups = 0;
DEBUG(3,("ads: lookup_usergroups_alt\n"));
@@ -504,10 +505,10 @@ static NTSTATUS lookup_usergroups_alt(struct winbindd_domain *domain,
count = ads_count_replies(ads, res);
*user_sids = NULL;
- *num_groups = 0;
+ num_groups = 0;
/* always add the primary group to the sid array */
- add_sid_to_array(mem_ctx, primary_group, user_sids, num_groups);
+ add_sid_to_array(mem_ctx, primary_group, user_sids, &num_groups);
if (count > 0) {
for (msg = ads_first_entry(ads, res); msg;
@@ -520,11 +521,12 @@ static NTSTATUS lookup_usergroups_alt(struct winbindd_domain *domain,
}
add_sid_to_array(mem_ctx, &group_sid, user_sids,
- num_groups);
+ &num_groups);
}
}
+ *p_num_groups = num_groups;
status = (user_sids != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
DEBUG(3,("ads lookup_usergroups (alt) for dn=%s\n", user_dn));
@@ -539,7 +541,7 @@ done:
static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const DOM_SID *sid,
- uint32 *num_groups, DOM_SID **user_sids)
+ uint32 *p_num_groups, DOM_SID **user_sids)
{
ADS_STRUCT *ads = NULL;
const char *attrs[] = {"tokenGroups", "primaryGroupID", NULL};
@@ -553,9 +555,10 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
uint32 primary_group_rid;
fstring sid_string;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ size_t num_groups = 0;
DEBUG(3,("ads: lookup_usergroups\n"));
- *num_groups = 0;
+ *p_num_groups = 0;
ads = ads_cached_connection(domain);
@@ -603,15 +606,17 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
/* there must always be at least one group in the token,
unless we are talking to a buggy Win2k server */
if (count == 0) {
- return lookup_usergroups_alt(domain, mem_ctx, user_dn,
+ status = lookup_usergroups_alt(domain, mem_ctx, user_dn,
&primary_group,
- num_groups, user_sids);
+ &num_groups, user_sids);
+ *p_num_groups = (uint32)num_groups;
+ return status;
}
*user_sids = NULL;
- *num_groups = 0;
+ num_groups = 0;
- add_sid_to_array(mem_ctx, &primary_group, user_sids, num_groups);
+ add_sid_to_array(mem_ctx, &primary_group, user_sids, &num_groups);
for (i=0;i<count;i++) {
@@ -621,9 +626,10 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
}
add_sid_to_array_unique(mem_ctx, &sids[i],
- user_sids, num_groups);
+ user_sids, &num_groups);
}
+ *p_num_groups = (uint32)num_groups;
status = (user_sids != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
DEBUG(3,("ads lookup_usergroups for sid=%s\n",
diff --git a/source3/nsswitch/winbindd_async.c b/source3/nsswitch/winbindd_async.c
index d43671380d..180fd651f5 100644
--- a/source3/nsswitch/winbindd_async.c
+++ b/source3/nsswitch/winbindd_async.c
@@ -707,9 +707,9 @@ enum winbindd_result winbindd_dual_lookupname(struct winbindd_domain *domain,
}
BOOL print_sidlist(TALLOC_CTX *mem_ctx, const DOM_SID *sids,
- int num_sids, char **result, ssize_t *len)
+ size_t num_sids, char **result, ssize_t *len)
{
- int i;
+ size_t i;
size_t buflen = 0;
*len = 0;
@@ -727,7 +727,7 @@ BOOL print_sidlist(TALLOC_CTX *mem_ctx, const DOM_SID *sids,
}
BOOL parse_sidlist(TALLOC_CTX *mem_ctx, char *sidstr,
- DOM_SID **sids, int *num_sids)
+ DOM_SID **sids, size_t *num_sids)
{
char *p, *q;
@@ -754,10 +754,10 @@ BOOL parse_sidlist(TALLOC_CTX *mem_ctx, char *sidstr,
return True;
}
-BOOL print_ridlist(TALLOC_CTX *mem_ctx, uint32 *rids, int num_rids,
+BOOL print_ridlist(TALLOC_CTX *mem_ctx, uint32 *rids, size_t num_rids,
char **result, ssize_t *len)
{
- int i;
+ size_t i;
size_t buflen = 0;
*len = 0;
@@ -775,7 +775,7 @@ BOOL print_ridlist(TALLOC_CTX *mem_ctx, uint32 *rids, int num_rids,
}
BOOL parse_ridlist(TALLOC_CTX *mem_ctx, char *ridstr,
- uint32 **sids, int *num_rids)
+ uint32 **sids, size_t *num_rids)
{
char *p;
@@ -802,10 +802,10 @@ static void getsidaliases_recv(TALLOC_CTX *mem_ctx, BOOL success,
void *c, void *private_data)
{
void (*cont)(void *priv, BOOL succ,
- DOM_SID *aliases, int num_aliases) = c;
+ DOM_SID *aliases, size_t num_aliases) = c;
char *aliases_str;
DOM_SID *sids = NULL;
- int num_sids = 0;
+ size_t num_sids = 0;
if (!success) {
DEBUG(5, ("Could not trigger getsidaliases\n"));
@@ -840,11 +840,11 @@ static void getsidaliases_recv(TALLOC_CTX *mem_ctx, BOOL success,
void winbindd_getsidaliases_async(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
- const DOM_SID *sids, int num_sids,
+ const DOM_SID *sids, size_t num_sids,
void (*cont)(void *private_data,
BOOL success,
const DOM_SID *aliases,
- int num_aliases),
+ size_t num_aliases),
void *private_data)
{
struct winbindd_request request;
@@ -874,10 +874,11 @@ enum winbindd_result winbindd_dual_getsidaliases(struct winbindd_domain *domain,
struct winbindd_cli_state *state)
{
DOM_SID *sids = NULL;
- int num_sids = 0;
+ size_t num_sids = 0;
char *sidstr;
- size_t len;
- int i, num_aliases;
+ ssize_t len;
+ size_t i;
+ uint32 num_aliases;
uint32 *alias_rids;
NTSTATUS result;
@@ -943,8 +944,8 @@ struct gettoken_state {
struct winbindd_domain *alias_domain;
struct winbindd_domain *builtin_domain;
DOM_SID *sids;
- int num_sids;
- void (*cont)(void *private_data, BOOL success, DOM_SID *sids, int num_sids);
+ size_t num_sids;
+ void (*cont)(void *private_data, BOOL success, DOM_SID *sids, size_t num_sids);
void *private_data;
};
@@ -953,12 +954,12 @@ static void gettoken_recvdomgroups(TALLOC_CTX *mem_ctx, BOOL success,
void *c, void *private_data);
static void gettoken_recvaliases(void *private_data, BOOL success,
const DOM_SID *aliases,
- int num_aliases);
+ size_t num_aliases);
void winbindd_gettoken_async(TALLOC_CTX *mem_ctx, const DOM_SID *user_sid,
void (*cont)(void *private_data, BOOL success,
- DOM_SID *sids, int num_sids),
+ DOM_SID *sids, size_t num_sids),
void *private_data)
{
struct winbindd_domain *domain;
@@ -1046,10 +1047,10 @@ static void gettoken_recvdomgroups(TALLOC_CTX *mem_ctx, BOOL success,
static void gettoken_recvaliases(void *private_data, BOOL success,
const DOM_SID *aliases,
- int num_aliases)
+ size_t num_aliases)
{
struct gettoken_state *state = private_data;
- int i;
+ size_t i;
if (!success) {
DEBUG(10, ("Could not receive domain local groups\n"));
@@ -1437,4 +1438,3 @@ void query_user_async(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
do_async_domain(mem_ctx, domain, &request, query_user_recv,
cont, private_data);
}
-
diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c
index 78b49d01ea..9164a135c5 100644
--- a/source3/nsswitch/winbindd_cache.c
+++ b/source3/nsswitch/winbindd_cache.c
@@ -564,7 +564,7 @@ struct cache_entry *centry_start(struct winbindd_domain *domain, NTSTATUS status
centry = SMB_XMALLOC_P(struct cache_entry);
centry->len = 8192; /* reasonable default */
- centry->data = SMB_XMALLOC_ARRAY(char, centry->len);
+ centry->data = SMB_XMALLOC_ARRAY(uint8, centry->len);
centry->ofs = 0;
centry->sequence_number = domain->sequence_number;
centry_put_uint32(centry, NT_STATUS_V(status));
diff --git a/source3/nsswitch/winbindd_group.c b/source3/nsswitch/winbindd_group.c
index c52ee2d960..ff2d19f5fc 100644
--- a/source3/nsswitch/winbindd_group.c
+++ b/source3/nsswitch/winbindd_group.c
@@ -59,7 +59,7 @@ static BOOL fill_grent(struct winbindd_gr *gr, const char *dom_name,
static BOOL fill_grent_mem(struct winbindd_domain *domain,
DOM_SID *group_sid,
enum SID_NAME_USE group_name_type,
- int *num_gr_mem, char **gr_mem, int *gr_mem_len)
+ size_t *num_gr_mem, char **gr_mem, size_t *gr_mem_len)
{
DOM_SID *sid_mem = NULL;
uint32 num_names = 0;
@@ -206,7 +206,7 @@ void winbindd_getgrnam(struct winbindd_cli_state *state)
enum SID_NAME_USE name_type;
fstring name_domain, name_group;
char *tmp, *gr_mem;
- int gr_mem_len;
+ size_t gr_mem_len;
gid_t gid;
/* Ensure null termination */
@@ -301,7 +301,7 @@ void winbindd_getgrgid(struct winbindd_cli_state *state)
enum SID_NAME_USE name_type;
fstring dom_name;
fstring group_name;
- int gr_mem_len;
+ size_t gr_mem_len;
char *gr_mem;
DEBUG(3, ("[%5lu]: getgrgid %lu\n", (unsigned long)state->pid,
@@ -615,7 +615,7 @@ void winbindd_getgrent(struct winbindd_cli_state *state)
fstring domain_group_name;
uint32 result;
gid_t group_gid;
- int gr_mem_len;
+ size_t gr_mem_len;
char *gr_mem, *new_gr_mem_list;
DOM_SID group_sid;
struct winbindd_domain *domain;
@@ -901,16 +901,16 @@ struct getgroups_state {
DOM_SID user_sid;
const DOM_SID *token_sids;
- int i, num_token_sids;
+ size_t i, num_token_sids;
gid_t *token_gids;
- int num_token_gids;
+ size_t num_token_gids;
};
static void getgroups_usersid_recv(void *private_data, BOOL success,
const DOM_SID *sid, enum SID_NAME_USE type);
static void getgroups_tokensids_recv(void *private_data, BOOL success,
- DOM_SID *token_sids, int num_token_sids);
+ DOM_SID *token_sids, size_t num_token_sids);
static void getgroups_sid2gid_recv(void *private_data, BOOL success, gid_t gid);
void winbindd_getgroups(struct winbindd_cli_state *state)
@@ -987,7 +987,7 @@ static void getgroups_usersid_recv(void *private_data, BOOL success,
}
static void getgroups_tokensids_recv(void *private_data, BOOL success,
- DOM_SID *token_sids, int num_token_sids)
+ DOM_SID *token_sids, size_t num_token_sids)
{
struct getgroups_state *s = private_data;
@@ -1051,7 +1051,7 @@ static void getgroups_sid2gid_recv(void *private_data, BOOL success, gid_t gid)
*/
static void getusersids_recv(void *private_data, BOOL success, DOM_SID *sids,
- int num_sids);
+ size_t num_sids);
void winbindd_getusersids(struct winbindd_cli_state *state)
{
@@ -1079,12 +1079,12 @@ void winbindd_getusersids(struct winbindd_cli_state *state)
}
static void getusersids_recv(void *private_data, BOOL success, DOM_SID *sids,
- int num_sids)
+ size_t num_sids)
{
struct winbindd_cli_state *state = private_data;
char *ret = NULL;
unsigned ofs, ret_size = 0;
- int i;
+ size_t i;
if (!success) {
request_error(state);
@@ -1151,9 +1151,9 @@ enum winbindd_result winbindd_dual_getuserdomgroups(struct winbindd_domain *doma
NTSTATUS status;
char *sidstring;
- size_t len;
+ ssize_t len;
DOM_SID *groups;
- int num_groups;
+ uint32 num_groups;
/* Ensure null termination */
state->request.data.sid[sizeof(state->request.data.sid)-1]='\0';
diff --git a/source3/nsswitch/winbindd_nss.h b/source3/nsswitch/winbindd_nss.h
index c1bb4b2600..c851ca7480 100644
--- a/source3/nsswitch/winbindd_nss.h
+++ b/source3/nsswitch/winbindd_nss.h
@@ -153,8 +153,8 @@ typedef struct winbindd_gr {
fstring gr_name;
fstring gr_passwd;
gid_t gr_gid;
- int num_gr_mem;
- int gr_mem_ofs; /* offset to group membership */
+ size_t num_gr_mem;
+ size_t gr_mem_ofs; /* offset to group membership */
char **gr_mem;
} WINBINDD_GR;
diff --git a/source3/nsswitch/winbindd_passdb.c b/source3/nsswitch/winbindd_passdb.c
index 4b22712e0a..d7856b5ce9 100644
--- a/source3/nsswitch/winbindd_passdb.c
+++ b/source3/nsswitch/winbindd_passdb.c
@@ -28,29 +28,27 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_WINBIND
-static void
-add_member(const char *domain, const char *user,
- char **members, int *num_members)
+static void add_member(const char *domain, const char *user,
+ char **pp_members, size_t *p_num_members)
{
fstring name;
fill_domain_username(name, domain, user);
safe_strcat(name, ",", sizeof(name)-1);
- string_append(members, name);
- *num_members += 1;
+ string_append(pp_members, name);
+ *p_num_members += 1;
}
/**********************************************************************
Add member users resulting from sid. Expand if it is a domain group.
**********************************************************************/
-static void
-add_expanded_sid(const DOM_SID *sid, char **members, int *num_members)
+static void add_expanded_sid(const DOM_SID *sid, char **pp_members, size_t *p_num_members)
{
DOM_SID dom_sid;
uint32 rid;
struct winbindd_domain *domain;
- int i;
+ size_t i;
char *domain_name = NULL;
char *name = NULL;
@@ -93,7 +91,7 @@ add_expanded_sid(const DOM_SID *sid, char **members, int *num_members)
DEBUG(10, ("Found name %s, type %d\n", name, type));
if (type == SID_NAME_USER) {
- add_member(domain_name, name, members, num_members);
+ add_member(domain_name, name, pp_members, p_num_members);
goto done;
}
@@ -134,7 +132,7 @@ add_expanded_sid(const DOM_SID *sid, char **members, int *num_members)
continue;
}
- add_member(domain->name, names[i], members, num_members);
+ add_member(domain->name, names[i], pp_members, p_num_members);
}
done:
@@ -144,10 +142,10 @@ add_expanded_sid(const DOM_SID *sid, char **members, int *num_members)
BOOL fill_passdb_alias_grmem(struct winbindd_domain *domain,
DOM_SID *group_sid,
- int *num_gr_mem, char **gr_mem, int *gr_mem_len)
+ size_t *num_gr_mem, char **gr_mem, size_t *gr_mem_len)
{
DOM_SID *members;
- int i, num_members;
+ size_t i, num_members;
*num_gr_mem = 0;
*gr_mem = NULL;
@@ -163,7 +161,7 @@ BOOL fill_passdb_alias_grmem(struct winbindd_domain *domain,
SAFE_FREE(members);
if (*gr_mem != NULL) {
- int len;
+ size_t len;
/* We have at least one member, strip off the last "," */
len = strlen(*gr_mem);
@@ -305,13 +303,15 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain,
static NTSTATUS lookup_useraliases(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 num_sids, const DOM_SID *sids,
- uint32 *num_aliases, uint32 **rids)
+ uint32 *p_num_aliases, uint32 **rids)
{
BOOL result;
+ size_t num_aliases;
result = pdb_enum_alias_memberships(mem_ctx, &domain->sid,
- sids, num_sids, rids, num_aliases);
+ sids, num_sids, rids, &num_aliases);
+ *p_num_aliases = num_aliases;
return result ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
}