diff options
66 files changed, 479 insertions, 464 deletions
diff --git a/source3/auth/auth.c b/source3/auth/auth.c index 92c90b6241..df7d6fc9c6 100644 --- a/source3/auth/auth.c +++ b/source3/auth/auth.c @@ -237,9 +237,9 @@ static NTSTATUS check_ntlm_password(const struct auth_context *auth_context, DEBUG(100, ("user_info has passwords of length %d and %d\n", (int)user_info->lm_resp.length, (int)user_info->nt_resp.length)); DEBUG(100, ("lm:\n")); - dump_data(100, user_info->lm_resp.data, user_info->lm_resp.length); + dump_data(100, (const char *)user_info->lm_resp.data, user_info->lm_resp.length); DEBUG(100, ("nt:\n")); - dump_data(100, user_info->nt_resp.data, user_info->nt_resp.length); + dump_data(100, (const char *)user_info->nt_resp.data, user_info->nt_resp.length); #endif /* This needs to be sorted: If it doesn't match, what should we do? */ diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c index 4abc6c6656..6e053b317e 100644 --- a/source3/auth/auth_domain.c +++ b/source3/auth/auth_domain.c @@ -119,7 +119,7 @@ machine %s. Error was : %s.\n", dc_name, nt_errstr(result))); /* We need to set up a creds chain on an unauthenticated netlogon pipe. */ uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS; uint32 sec_chan_type = 0; - char machine_pwd[16]; + unsigned char machine_pwd[16]; if (!get_trust_pw(domain, machine_pwd, &sec_chan_type)) { DEBUG(0, ("connect_to_domain_password_server: could not fetch " diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 194a1ad532..49122bd441 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -373,7 +373,7 @@ BOOL make_user_info_for_reply(auth_usersupplied_info **user_info, #ifdef DEBUG_PASSWORD DEBUG(10,("Unencrypted password (len %d):\n",(int)plaintext_password.length)); - dump_data(100, plaintext_password.data, plaintext_password.length); + dump_data(100, (const char *)plaintext_password.data, plaintext_password.length); #endif SMBencrypt( (const char *)plaintext_password.data, (const uchar*)chal, local_lm_response); @@ -693,7 +693,7 @@ NT_USER_TOKEN *get_root_nt_token( void ) ******************************************************************************/ static NTSTATUS get_user_groups(const char *username, uid_t uid, gid_t gid, - int *n_groups, DOM_SID **groups, gid_t **unix_groups) + size_t *n_groups, DOM_SID **groups, gid_t **unix_groups) { int n_unix_groups; int i; @@ -787,7 +787,7 @@ static NTSTATUS add_user_groups(auth_serversupplied_info **server_info, NTSTATUS nt_status; const DOM_SID *user_sid = pdb_get_user_sid(sampass); const DOM_SID *group_sid = pdb_get_group_sid(sampass); - int n_groupSIDs = 0; + size_t n_groupSIDs = 0; DOM_SID *groupSIDs = NULL; gid_t *unix_groups = NULL; NT_USER_TOKEN *token; @@ -1197,7 +1197,7 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, uid_t uid; gid_t gid; - int n_lgroupSIDs; + size_t n_lgroupSIDs; DOM_SID *lgroupSIDs = NULL; gid_t *unix_groups = NULL; diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c index 3ca074581c..1e8586786c 100644 --- a/source3/groupdb/mapping.c +++ b/source3/groupdb/mapping.c @@ -400,8 +400,8 @@ static BOOL group_map_remove(const DOM_SID *sid) Enumerate the group mapping. ****************************************************************************/ -static BOOL enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap, - int *num_entries, BOOL unix_only) +static BOOL enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **pp_rmap, + size_t *p_num_entries, BOOL unix_only) { TDB_DATA kbuf, dbuf, newkey; fstring string_sid; @@ -409,15 +409,15 @@ static BOOL enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap, GROUP_MAP map; GROUP_MAP *mapt; int ret; - int entries=0; + size_t entries=0; if(!init_group_mapping()) { DEBUG(0,("failed to initialize group mapping\n")); return(False); } - *num_entries=0; - *rmap=NULL; + *p_num_entries=0; + *pp_rmap=NULL; for (kbuf = tdb_firstkey(tdb); kbuf.dptr; @@ -458,14 +458,14 @@ static BOOL enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap, decode_sid_name_use(group_type, map.sid_name_use); DEBUG(11,("enum_group_mapping: returning group %s of type %s\n", map.nt_name ,group_type)); - mapt= SMB_REALLOC_ARRAY((*rmap), GROUP_MAP, entries+1); + mapt= SMB_REALLOC_ARRAY((*pp_rmap), GROUP_MAP, entries+1); if (!mapt) { DEBUG(0,("enum_group_mapping: Unable to enlarge group map!\n")); - SAFE_FREE(*rmap); + SAFE_FREE(*pp_rmap); return False; } else - (*rmap) = mapt; + (*pp_rmap) = mapt; mapt[entries].gid = map.gid; sid_copy( &mapt[entries].sid, &map.sid); @@ -477,7 +477,7 @@ static BOOL enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap, } - *num_entries=entries; + *p_num_entries=entries; return True; } @@ -486,7 +486,7 @@ static BOOL enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap, * store a list of aliases a SID is member of hanging off MEMBEROF/SID. */ static NTSTATUS one_alias_membership(const DOM_SID *member, - DOM_SID **sids, int *num) + DOM_SID **sids, size_t *num) { fstring key, string_sid; TDB_DATA kbuf, dbuf; @@ -528,10 +528,10 @@ static NTSTATUS one_alias_membership(const DOM_SID *member, return NT_STATUS_OK; } -static NTSTATUS alias_memberships(const DOM_SID *members, int num_members, - DOM_SID **sids, int *num) +static NTSTATUS alias_memberships(const DOM_SID *members, size_t num_members, + DOM_SID **sids, size_t *num) { - int i; + size_t i; *num = 0; *sids = NULL; @@ -547,7 +547,7 @@ static NTSTATUS alias_memberships(const DOM_SID *members, int num_members, static BOOL is_aliasmem(const DOM_SID *alias, const DOM_SID *member) { DOM_SID *sids; - int i, num; + size_t i, num; /* This feels the wrong way round, but the on-disk data structure * dictates it this way. */ @@ -622,7 +622,7 @@ static NTSTATUS add_aliasmem(const DOM_SID *alias, const DOM_SID *member) struct aliasmem_closure { const DOM_SID *alias; DOM_SID **sids; - int *num; + size_t *num; }; static int collect_aliasmem(TDB_CONTEXT *tdb_ctx, TDB_DATA key, TDB_DATA data, @@ -671,7 +671,7 @@ static int collect_aliasmem(TDB_CONTEXT *tdb_ctx, TDB_DATA key, TDB_DATA data, return 0; } -static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, int *num) +static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, size_t *num) { GROUP_MAP map; struct aliasmem_closure closure; @@ -703,7 +703,7 @@ static NTSTATUS del_aliasmem(const DOM_SID *alias, const DOM_SID *member) { NTSTATUS result; DOM_SID *sids; - int i, num; + size_t i, num; BOOL found = False; char *member_string; TDB_DATA kbuf, dbuf; @@ -1136,10 +1136,10 @@ NTSTATUS pdb_default_delete_group_mapping_entry(struct pdb_methods *methods, NTSTATUS pdb_default_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) { - return enum_group_mapping(sid_name_use, rmap, num_entries, unix_only) ? + return enum_group_mapping(sid_name_use, pp_rmap, p_num_entries, unix_only) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; } @@ -1247,22 +1247,22 @@ NTSTATUS pdb_default_del_aliasmem(struct pdb_methods *methods, } NTSTATUS pdb_default_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) { - return enum_aliasmem(alias, members, num_members); + return enum_aliasmem(alias, pp_members, p_num_members); } NTSTATUS pdb_default_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) { DOM_SID *alias_sids; - int i, num_alias_sids; + size_t i, num_alias_sids; NTSTATUS result; alias_sids = NULL; @@ -1274,17 +1274,17 @@ NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods, if (!NT_STATUS_IS_OK(result)) return result; - *alias_rids = TALLOC_ARRAY(mem_ctx, uint32, num_alias_sids); - if (*alias_rids == NULL) + *pp_alias_rids = TALLOC_ARRAY(mem_ctx, uint32, num_alias_sids); + if (*pp_alias_rids == NULL) return NT_STATUS_NO_MEMORY; - *num_alias_rids = 0; + *p_num_alias_rids = 0; for (i=0; i<num_alias_sids; i++) { if (!sid_peek_check_rid(domain_sid, &alias_sids[i], - &(*alias_rids)[*num_alias_rids])) + &(*pp_alias_rids)[*p_num_alias_rids])) continue; - *num_alias_rids += 1; + *p_num_alias_rids += 1; } SAFE_FREE(alias_sids); @@ -1334,7 +1334,7 @@ NTSTATUS pdb_nop_delete_group_mapping_entry(struct pdb_methods *methods, NTSTATUS pdb_nop_enum_group_mapping(struct pdb_methods *methods, enum SID_NAME_USE sid_name_use, - GROUP_MAP **rmap, int *num_entries, + GROUP_MAP **rmap, size_t *num_entries, BOOL unix_only) { return NT_STATUS_UNSUCCESSFUL; diff --git a/source3/include/passdb.h b/source3/include/passdb.h index 4964ff3759..293d18a42a 100644 --- a/source3/include/passdb.h +++ b/source3/include/passdb.h @@ -128,16 +128,14 @@ enum pdb_value_state { #define IS_SAM_DEFAULT(x, flag) (pdb_get_init_flags(x, flag) == PDB_DEFAULT) /* cache for bad password lockout data, to be used on replicated SAMs */ -typedef struct logon_cache_struct -{ +typedef struct logon_cache_struct { time_t entry_timestamp; uint16 acct_ctrl; uint16 bad_password_count; time_t bad_password_time; } LOGIN_CACHE; -typedef struct sam_passwd -{ +typedef struct sam_passwd { TALLOC_CTX *mem_ctx; void (*free_fn)(struct sam_passwd **); @@ -225,11 +223,10 @@ typedef struct sam_group { } SAM_GROUP; -struct acct_info -{ - fstring acct_name; /* account name */ - fstring acct_desc; /* account name */ - uint32 rid; /* domain-relative RID */ +struct acct_info { + fstring acct_name; /* account name */ + fstring acct_desc; /* account name */ + uint32 rid; /* domain-relative RID */ }; struct samr_displayentry { @@ -267,9 +264,10 @@ struct pdb_search { /* * This next constant specifies the version number of the PASSDB interface * this SAMBA will load. Increment this if *ANY* changes are made to the interface. + * Changed interface to fix int -> size_t problems. JRA. */ -#define PASSDB_INTERFACE_VERSION 10 +#define PASSDB_INTERFACE_VERSION 11 typedef struct pdb_context { @@ -316,20 +314,20 @@ typedef struct pdb_context NTSTATUS (*pdb_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 (*pdb_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 (*pdb_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 (*pdb_find_alias)(struct pdb_context *context, const char *name, DOM_SID *sid); @@ -358,22 +356,22 @@ typedef struct pdb_context NTSTATUS (*pdb_enum_aliasmem)(struct pdb_context *context, const DOM_SID *alias, - DOM_SID **members, int *num_members); + DOM_SID **pp_members, size_t *p_num_members); NTSTATUS (*pdb_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 (*pdb_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, + const char ***pp_names, uint32 **attrs); NTSTATUS (*pdb_get_account_policy)(struct pdb_context *context, @@ -445,20 +443,20 @@ typedef struct pdb_methods NTSTATUS (*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); NTSTATUS (*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); NTSTATUS (*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); NTSTATUS (*find_alias)(struct pdb_methods *methods, const char *name, DOM_SID *sid); @@ -483,21 +481,21 @@ typedef struct pdb_methods const DOM_SID *alias, const DOM_SID *member); NTSTATUS (*enum_aliasmem)(struct pdb_methods *methods, const DOM_SID *alias, DOM_SID **members, - int *num_members); + size_t *p_num_members); NTSTATUS (*enum_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); NTSTATUS (*lookup_rids)(struct pdb_methods *methods, TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid, int num_rids, uint32 *rids, - const char ***names, + const char ***pp_names, uint32 **attrs); NTSTATUS (*get_account_policy)(struct pdb_methods *methods, diff --git a/source3/lib/clobber.c b/source3/lib/clobber.c index fb3a0dc281..f39b94538e 100644 --- a/source3/lib/clobber.c +++ b/source3/lib/clobber.c @@ -54,7 +54,9 @@ void clobber_region(const char *fn, unsigned int line, char *dest, size_t len) * (This is not redundant with the clobbering above. The * marking might not actually take effect if we're not running * under valgrind.) */ +#if 0 VALGRIND_MAKE_WRITABLE(dest, len); +#endif #endif /* VALGRIND */ #endif /* DEVELOPER */ } diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c index d58165fed0..f738f45efa 100644 --- a/source3/lib/iconv.c +++ b/source3/lib/iconv.c @@ -642,15 +642,15 @@ static size_t utf8_pull(void *cd, const char **inbuf, size_t *inbytesleft, *inbytesleft = in_left; *outbytesleft = out_left; - *inbuf = c; - *outbuf = uc; + *inbuf = (char *)c; + *outbuf = (char *)uc; return 0; error: *inbytesleft = in_left; *outbytesleft = out_left; - *inbuf = c; - *outbuf = uc; + *inbuf = (char *)c; + *outbuf = (char *)uc; return -1; } @@ -755,16 +755,16 @@ static size_t utf8_push(void *cd, const char **inbuf, size_t *inbytesleft, *inbytesleft = in_left; *outbytesleft = out_left; - *inbuf = uc; - *outbuf = c; + *inbuf = (char *)uc; + *outbuf = (char *)c; return 0; error: *inbytesleft = in_left; *outbytesleft = out_left; - *inbuf = uc; - *outbuf = c; + *inbuf = (char *)uc; + *outbuf = (char *)c; return -1; } diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c index ff0631b82f..ee69613df0 100644 --- a/source3/lib/privileges.c +++ b/source3/lib/privileges.c @@ -104,7 +104,7 @@ PRIVS privs[] = { }; typedef struct { - int count; + size_t count; DOM_SID *list; } SID_LIST; diff --git a/source3/lib/system_smbd.c b/source3/lib/system_smbd.c index f124983006..1afd44b709 100644 --- a/source3/lib/system_smbd.c +++ b/source3/lib/system_smbd.c @@ -27,15 +27,58 @@ #include "includes.h" #ifndef HAVE_GETGROUPLIST + +static int int_compare( int *a, int *b ) +{ + if ( *a == *b ) + return 0; + else if ( *a < *b ) + return -1; + else + return 1; +} + +void remove_duplicate_gids( int *num_groups, gid_t *groups ) +{ + int i; + int count = *num_groups; + + if ( *num_groups <= 0 || !groups ) + return; + + DEBUG(8,("remove_duplicate_gids: Enter %d gids\n", *num_groups)); + + qsort( groups, *num_groups, sizeof(gid_t), QSORT_CAST int_compare ); + + for ( i=1; i<count; ) { + if ( groups[i-1] == groups[i] ) { + memmove( &groups[i-1], &groups[i], (count - i + 1)*sizeof(gid_t) ); + + /* decrement the total number of groups and do not increment + the loop counter */ + count--; + continue; + } + i++; + } + + *num_groups = count; + + DEBUG(8,("remove_duplicate_gids: Exit %d gids\n", *num_groups)); + + return; +} + /* This is a *much* faster way of getting the list of groups for a user - without changing the current supplemenrary group list. The old + without changing the current supplementary group list. The old method used getgrent() which could take 20 minutes on a really big network with hundeds of thousands of groups and users. The new method takes a couple of seconds. NOTE!! this function only works if it is called as root! */ + static int getgrouplist_internals(const char *user, gid_t gid, gid_t *groups, int *grpcnt) { gid_t *gids_saved; @@ -52,7 +95,7 @@ static int getgrouplist_internals(const char *user, gid_t gid, gid_t *groups, in /* this shouldn't happen */ return -1; } - + gids_saved = SMB_MALLOC_ARRAY(gid_t, ngrp_saved+1); if (!gids_saved) { errno = ENOMEM; @@ -79,18 +122,26 @@ static int getgrouplist_internals(const char *user, gid_t gid, gid_t *groups, in setgid(gid); num_gids = getgroups(0, NULL); + if (num_gids == -1) { + SAFE_FREE(gids_saved); + /* very strange! */ + return -1; + } + if (num_gids + 1 > *grpcnt) { *grpcnt = num_gids + 1; ret = -1; } else { ret = getgroups(*grpcnt - 1, &groups[1]); - if (ret >= 0) { - groups[0] = gid; - *grpcnt = ret + 1; + if (ret < 0) { + SAFE_FREE(gids_saved); + /* very strange! */ + return -1; } - - /* remove any duplicates gids in the list */ + groups[0] = gid; + *grpcnt = ret + 1; + /* remove any duplicates gids in the list */ remove_duplicate_gids( grpcnt, groups ); } @@ -103,7 +154,7 @@ static int getgrouplist_internals(const char *user, gid_t gid, gid_t *groups, in free(gids_saved); return -1; } - + free(gids_saved); return ret; } @@ -140,9 +191,10 @@ static int sys_getgrouplist(const char *user, gid_t gid, gid_t *groups, int *grp } BOOL getgroups_user(const char *user, gid_t primary_gid, - gid_t **ret_groups, int *ngroups) + gid_t **ret_groups, size_t *p_ngroups) { - int ngrp, max_grp; + size_t ngrp; + int max_grp; gid_t *temp_groups; gid_t *groups; int i; @@ -154,9 +206,8 @@ BOOL getgroups_user(const char *user, gid_t primary_gid, } if (sys_getgrouplist(user, primary_gid, temp_groups, &max_grp) == -1) { - gid_t *groups_tmp; - + groups_tmp = SMB_REALLOC_ARRAY(temp_groups, gid_t, max_grp); if (!groups_tmp) { @@ -183,7 +234,7 @@ BOOL getgroups_user(const char *user, gid_t primary_gid, for (i=0; i<max_grp; i++) add_gid_to_array_unique(NULL, temp_groups[i], &groups, &ngrp); - *ngroups = ngrp; + *p_ngroups = ngrp; *ret_groups = groups; SAFE_FREE(temp_groups); return True; @@ -192,34 +243,34 @@ BOOL getgroups_user(const char *user, gid_t primary_gid, NTSTATUS pdb_default_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) { - int i; + size_t i; - if (!getgroups_user(username, primary_gid, gids, num_groups)) { + if (!getgroups_user(username, primary_gid, pp_gids, p_num_groups)) { return NT_STATUS_NO_SUCH_USER; } - if (*num_groups == 0) { + if (*p_num_groups == 0) { smb_panic("primary group missing"); } - *sids = SMB_MALLOC_ARRAY(DOM_SID, *num_groups); + *pp_sids = SMB_MALLOC_ARRAY(DOM_SID, *p_num_groups); - if (*sids == NULL) { - SAFE_FREE(gids); + if (*pp_sids == NULL) { + SAFE_FREE(pp_gids); return NT_STATUS_NO_MEMORY; } - for (i=0; i<*num_groups; i++) { - if (!NT_STATUS_IS_OK(gid_to_sid(&(*sids)[i], (*gids)[i]))) { + for (i=0; i<*p_num_groups; i++) { + if (!NT_STATUS_IS_OK(gid_to_sid(&(*pp_sids)[i], (*pp_gids)[i]))) { DEBUG(1, ("get_user_groups: failed to convert " "gid %ld to a sid!\n", - (long int)(*gids)[i+1])); - SAFE_FREE(*sids); - SAFE_FREE(*gids); + (long int)(*pp_gids)[i+1])); + SAFE_FREE(*pp_sids); + SAFE_FREE(*pp_gids); return NT_STATUS_NO_SUCH_USER; } } diff --git a/source3/lib/util.c b/source3/lib/util.c index a5cfe95b66..30886b0dd8 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -282,25 +282,25 @@ const char *tmpdir(void) ****************************************************************************/ void add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid, - gid_t **gids, int *num) + gid_t **gids, size_t *num_gids) { int i; - for (i=0; i<*num; i++) { + for (i=0; i<*num_gids; i++) { if ((*gids)[i] == gid) return; } if (mem_ctx != NULL) - *gids = TALLOC_REALLOC_ARRAY(mem_ctx, *gids, gid_t, *num+1); + *gids = TALLOC_REALLOC_ARRAY(mem_ctx, *gids, gid_t, *num_gids+1); else - *gids = SMB_REALLOC_ARRAY(*gids, gid_t, *num+1); + *gids = SMB_REALLOC_ARRAY(*gids, gid_t, *num_gids+1); if (*gids == NULL) return; - (*gids)[*num] = gid; - *num += 1; + (*gids)[*num_gids] = gid; + *num_gids += 1; } /**************************************************************************** @@ -2093,7 +2093,7 @@ void dump_data_pw(const char *msg, const uchar * data, size_t len) DEBUG(11, ("%s", msg)); if (data != NULL && len > 0) { - dump_data(11, data, len); + dump_data(11, (const char *)data, len); } #endif } diff --git a/source3/lib/util_getent.c b/source3/lib/util_getent.c index 1b01cae5fa..475b0da87b 100644 --- a/source3/lib/util_getent.c +++ b/source3/lib/util_getent.c @@ -304,48 +304,3 @@ void free_userlist(struct sys_userlist *list_head) SAFE_FREE(old_head); } } - -/**************************************************************** -****************************************************************/ - -static int int_compare( int *a, int *b ) -{ - if ( *a == *b ) - return 0; - else if ( *a < *b ) - return -1; - else - return 1; -} - -void remove_duplicate_gids( int *num_groups, gid_t *groups ) -{ - int i; - int count = *num_groups; - - if ( *num_groups <= 0 || !groups ) - return; - - - DEBUG(8,("remove_duplicate_gids: Enter %d gids\n", *num_groups)); - - qsort( groups, *num_groups, sizeof(gid_t), QSORT_CAST int_compare ); - - for ( i=1; i<count; ) { - if ( groups[i-1] == groups[i] ) { - memmove( &groups[i-1], &groups[i], (count - i + 1)*sizeof(gid_t) ); - - /* decrement the total number of groups and do not increment - the loop counter */ - count--; - continue; - } - i++; - } - - *num_groups = count; - - DEBUG(8,("remove_duplicate_gids: Exit %d gids\n", *num_groups)); - - return; -} diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c index b9b4aff420..f3f6c938ee 100644 --- a/source3/lib/util_sid.c +++ b/source3/lib/util_sid.c @@ -637,7 +637,7 @@ DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, const DOM_SID *src) ********************************************************************/ void add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid, - DOM_SID **sids, int *num) + DOM_SID **sids, size_t *num) { if (mem_ctx != NULL) *sids = TALLOC_REALLOC_ARRAY(mem_ctx, *sids, DOM_SID, @@ -660,9 +660,9 @@ void add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid, ********************************************************************/ void add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid, - DOM_SID **sids, int *num_sids) + DOM_SID **sids, size_t *num_sids) { - int i; + size_t i; for (i=0; i<(*num_sids); i++) { if (sid_compare(sid, &(*sids)[i]) == 0) @@ -676,10 +676,10 @@ void add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid, Remove SID from an array ********************************************************************/ -void del_sid_from_array(const DOM_SID *sid, DOM_SID **sids, int *num) +void del_sid_from_array(const DOM_SID *sid, DOM_SID **sids, size_t *num) { DOM_SID *sid_list = *sids; - int i; + size_t i; for ( i=0; i<*num; i++ ) { @@ -700,4 +700,3 @@ void del_sid_from_array(const DOM_SID *sid, DOM_SID **sids, int *num) return; } - diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c index c25f9e4bde..004079529f 100644 --- a/source3/libads/kerberos.c +++ b/source3/libads/kerberos.c @@ -88,7 +88,7 @@ int kerberos_kinit_password(const char *principal, return code; } - if ((code = krb5_get_init_creds_password(ctx, &my_creds, me, password, + if ((code = krb5_get_init_creds_password(ctx, &my_creds, me, CONST_DISCARD(char *,password), kerb_prompter, NULL, 0, NULL, NULL))) { krb5_free_principal(ctx, me); diff --git a/source3/libads/krb5_setpw.c b/source3/libads/krb5_setpw.c index c261d15c21..5488c5908f 100644 --- a/source3/libads/krb5_setpw.c +++ b/source3/libads/krb5_setpw.c @@ -341,7 +341,8 @@ static ADS_STATUS do_krb5_kpasswd_request(krb5_context context, { krb5_auth_context auth_context = NULL; krb5_data ap_req, chpw_req, chpw_rep; - int ret, sock, addr_len; + int ret, sock; + socklen_t addr_len; struct sockaddr remote_addr, local_addr; krb5_address local_kaddr, remote_kaddr; diff --git a/source3/libmsrpc/cac_lsarpc.c b/source3/libmsrpc/cac_lsarpc.c index 3896c715f5..d2e52f01a4 100644 --- a/source3/libmsrpc/cac_lsarpc.c +++ b/source3/libmsrpc/cac_lsarpc.c @@ -728,7 +728,7 @@ int cac_LsaQueryTrustedDomainInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, str int cac_LsaEnumPrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaEnumPrivileges *op) { struct rpc_pipe_client *pipe_hnd = NULL; - int num_privs; + uint32 num_privs; char **priv_names; uint32 *high_bits; uint32 *low_bits; diff --git a/source3/libmsrpc/cac_winreg.c b/source3/libmsrpc/cac_winreg.c index 66fa8806fd..1d60cc8fb2 100644 --- a/source3/libmsrpc/cac_winreg.c +++ b/source3/libmsrpc/cac_winreg.c @@ -667,7 +667,7 @@ int cac_RegEnumValues(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegEnumV } /*we need to assume that the max number of values will be enumerated*/ - types_out = talloc_array(mem_ctx, int, op->in.max_values); + types_out = (uint32 *)talloc_array(mem_ctx, int, op->in.max_values); if(!types_out) { hnd->status = NT_STATUS_NO_MEMORY; return CAC_FAILURE; diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index b53e19ef98..34f73cfafe 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -294,7 +294,7 @@ BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char const char *old_password) { pstring param; - char data[532]; + unsigned char data[532]; char *p = param; unsigned char old_pw_hash[16]; unsigned char new_pw_hash[16]; @@ -332,7 +332,7 @@ BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char #ifdef DEBUG_PASSWORD DEBUG(100,("make_oem_passwd_hash\n")); - dump_data(100, data, 516); + dump_data(100, (char *)data, 516); #endif SamOEMhash( (unsigned char *)data, (unsigned char *)old_pw_hash, 516); @@ -350,7 +350,7 @@ BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char 0,0, /* fid, flags */ NULL,0,0, /* setup, length, max */ param,param_len,2, /* param, length, max */ - data,data_len,0 /* data, length, max */ + (char *)data,data_len,0 /* data, length, max */ ) == False) { DEBUG(0,("cli_oem_change_password: Failed to send password change for user %s\n", user )); diff --git a/source3/libsmb/clispnego.c b/source3/libsmb/clispnego.c index 33fc265f79..6340a9bdcd 100644 --- a/source3/libsmb/clispnego.c +++ b/source3/libsmb/clispnego.c @@ -26,7 +26,7 @@ generate a negTokenInit packet given a GUID, a list of supported OIDs (the mechanisms) and a principal name string */ -DATA_BLOB spnego_gen_negTokenInit(uint8 guid[16], +DATA_BLOB spnego_gen_negTokenInit(char guid[16], const char *OIDs[], const char *principal) { diff --git a/source3/libsmb/credentials.c b/source3/libsmb/credentials.c index 3f2dcd850b..edb242df7e 100644 --- a/source3/libsmb/credentials.c +++ b/source3/libsmb/credentials.c @@ -115,7 +115,7 @@ void creds_server_init(struct dcinfo *dc, { DEBUG(10,("creds_server_init: client chal : %s\n", credstr(clnt_chal->data) )); DEBUG(10,("creds_server_init: server chal : %s\n", credstr(srv_chal->data) )); - dump_data_pw("creds_server_init: machine pass", mach_pw, 16); + dump_data_pw("creds_server_init: machine pass", (const unsigned char *)mach_pw, 16); /* Just in case this isn't already there */ memcpy(dc->mach_pw, mach_pw, 16); @@ -205,14 +205,14 @@ BOOL creds_server_step(struct dcinfo *dc, const DOM_CRED *received_cred, DOM_CRE void creds_client_init(struct dcinfo *dc, DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, - const char mach_pw[16], + const unsigned char mach_pw[16], DOM_CHAL *init_chal_out) { dc->sequence = time(NULL); DEBUG(10,("creds_client_init: client chal : %s\n", credstr(clnt_chal->data) )); DEBUG(10,("creds_client_init: server chal : %s\n", credstr(srv_chal->data) )); - dump_data_pw("creds_client_init: machine pass", mach_pw, 16); + dump_data_pw("creds_client_init: machine pass", (const unsigned char *)mach_pw, 16); /* Just in case this isn't already there */ memcpy(dc->mach_pw, mach_pw, 16); diff --git a/source3/libsmb/ntlm_check.c b/source3/libsmb/ntlm_check.c index 26e4c76fd3..212bc19767 100644 --- a/source3/libsmb/ntlm_check.c +++ b/source3/libsmb/ntlm_check.c @@ -65,13 +65,13 @@ static BOOL smb_pwd_check_ntlmv1(const DATA_BLOB *nt_response, #ifdef DEBUG_PASSWORD DEBUG(100,("Part password (P16) was |\n")); - dump_data(100, part_passwd, 16); + dump_data(100, (const char *)part_passwd, 16); DEBUGADD(100,("Password from client was |\n")); - dump_data(100, nt_response->data, nt_response->length); + dump_data(100, (const char *)nt_response->data, nt_response->length); DEBUGADD(100,("Given challenge was |\n")); - dump_data(100, sec_blob->data, sec_blob->length); + dump_data(100, (const char *)sec_blob->data, sec_blob->length); DEBUGADD(100,("Value from encryption was |\n")); - dump_data(100, p24, 24); + dump_data(100, (const char *)p24, 24); #endif return (memcmp(p24, nt_response->data, 24) == 0); } @@ -136,15 +136,15 @@ static BOOL smb_pwd_check_ntlmv2(const DATA_BLOB *ntv2_response, #if DEBUG_PASSWORD DEBUG(100,("Part password (P16) was |\n")); - dump_data(100, part_passwd, 16); + dump_data(100, (const char *)part_passwd, 16); DEBUGADD(100,("Password from client was |\n")); - dump_data(100, ntv2_response->data, ntv2_response->length); + dump_data(100, (const char *)ntv2_response->data, ntv2_response->length); DEBUGADD(100,("Variable data from client was |\n")); - dump_data(100, client_key_data.data, client_key_data.length); + dump_data(100, (const char *)client_key_data.data, client_key_data.length); DEBUGADD(100,("Given challenge was |\n")); - dump_data(100, sec_blob->data, sec_blob->length); + dump_data(100, (const char *)sec_blob->data, sec_blob->length); DEBUGADD(100,("Value from encryption was |\n")); - dump_data(100, value_from_encryption, 16); + dump_data(100, (const char *)value_from_encryption, 16); #endif data_blob_clear_free(&client_key_data); res = (memcmp(value_from_encryption, client_response, 16) == 0); diff --git a/source3/libsmb/ntlmssp_sign.c b/source3/libsmb/ntlmssp_sign.c index 51023ca356..e41cd6437c 100644 --- a/source3/libsmb/ntlmssp_sign.c +++ b/source3/libsmb/ntlmssp_sign.c @@ -43,7 +43,7 @@ static void calc_ntlmv2_key(unsigned char subkey[16], struct MD5Context ctx3; MD5Init(&ctx3); MD5Update(&ctx3, session_key.data, session_key.length); - MD5Update(&ctx3, constant, strlen(constant)+1); + MD5Update(&ctx3, (const unsigned char *)constant, strlen(constant)+1); MD5Final(subkey, &ctx3); } @@ -196,10 +196,10 @@ NTSTATUS ntlmssp_check_packet(NTLMSSP_STATE *ntlmssp_state, if (local_sig.length != sig->length || memcmp(local_sig.data, sig->data, sig->length) != 0) { DEBUG(5, ("BAD SIG NTLM2: wanted signature of\n")); - dump_data(5, local_sig.data, local_sig.length); + dump_data(5, (const char *)local_sig.data, local_sig.length); DEBUG(5, ("BAD SIG: got signature of\n")); - dump_data(5, sig->data, sig->length); + dump_data(5, (const char *)sig->data, sig->length); DEBUG(0, ("NTLMSSP NTLM2 packet check failed due to invalid signature!\n")); data_blob_free(&local_sig); @@ -209,10 +209,10 @@ NTSTATUS ntlmssp_check_packet(NTLMSSP_STATE *ntlmssp_state, if (local_sig.length != sig->length || memcmp(local_sig.data + 8, sig->data + 8, sig->length - 8) != 0) { DEBUG(5, ("BAD SIG NTLM1: wanted signature of\n")); - dump_data(5, local_sig.data, local_sig.length); + dump_data(5, (const char *)local_sig.data, local_sig.length); DEBUG(5, ("BAD SIG: got signature of\n")); - dump_data(5, sig->data, sig->length); + dump_data(5, (const char *)sig->data, sig->length); DEBUG(0, ("NTLMSSP NTLM1 packet check failed due to invalid signature!\n")); data_blob_free(&local_sig); diff --git a/source3/libsmb/smbdes.c b/source3/libsmb/smbdes.c index dc49396d9e..4378385f3f 100644 --- a/source3/libsmb/smbdes.c +++ b/source3/libsmb/smbdes.c @@ -348,7 +348,7 @@ void cred_hash2(unsigned char *out, const unsigned char *in, const unsigned char des_crypt56(out, buf, key2, 1); } -void cred_hash3(unsigned char *out, unsigned char *in, const unsigned char *key, int forw) +void cred_hash3(unsigned char *out, const unsigned char *in, const unsigned char *key, int forw) { static unsigned char key2[8]; diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c index 0c9eacfe4c..f99e48a0b9 100644 --- a/source3/libsmb/smbencrypt.c +++ b/source3/libsmb/smbencrypt.c @@ -44,9 +44,9 @@ BOOL SMBencrypt(const char *passwd, const uchar *c8, uchar p24[24]) #ifdef DEBUG_PASSWORD DEBUG(100,("SMBencrypt: lm#, challenge, response\n")); - dump_data(100, (char *)p21, 16); + dump_data(100, (const char *)p21, 16); dump_data(100, (const char *)c8, 8); - dump_data(100, (char *)p24, 24); + dump_data(100, (const char *)p24, 24); #endif return ret; @@ -198,8 +198,8 @@ BOOL ntv2_owf_gen(const uchar owf[16], DEBUG(100, ("ntv2_owf_gen: user, domain, owfkey, kr\n")); dump_data(100, (const char *)user, user_byte_len); dump_data(100, (const char *)domain, domain_byte_len); - dump_data(100, owf, 16); - dump_data(100, kr_buf, 16); + dump_data(100, (const char *)owf, 16); + dump_data(100, (const char *)kr_buf, 16); #endif SAFE_FREE(user); @@ -271,9 +271,9 @@ void SMBOWFencrypt_ntv2(const uchar kr[16], #ifdef DEBUG_PASSWORD DEBUG(100, ("SMBOWFencrypt_ntv2: srv_chal, cli_chal, resp_buf\n")); - dump_data(100, srv_chal->data, srv_chal->length); - dump_data(100, cli_chal->data, cli_chal->length); - dump_data(100, resp_buf, 16); + dump_data(100, (const char *)srv_chal->data, srv_chal->length); + dump_data(100, (const char *)cli_chal->data, cli_chal->length); + dump_data(100, (const char *)resp_buf, 16); #endif } @@ -290,7 +290,7 @@ void SMBsesskeygen_ntv2(const uchar kr[16], #ifdef DEBUG_PASSWORD DEBUG(100, ("SMBsesskeygen_ntv2:\n")); - dump_data(100, sess_key, 16); + dump_data(100, (const char *)sess_key, 16); #endif } @@ -304,7 +304,7 @@ void SMBsesskeygen_ntv1(const uchar kr[16], #ifdef DEBUG_PASSWORD DEBUG(100, ("SMBsesskeygen_ntv1:\n")); - dump_data(100, sess_key, 16); + dump_data(100, (const char *)sess_key, 16); #endif } @@ -324,7 +324,7 @@ void SMBsesskeygen_lm_sess_key(const uchar lm_hash[16], #ifdef DEBUG_PASSWORD DEBUG(100, ("SMBsesskeygen_lmv1_jerry:\n")); - dump_data(100, sess_key, 16); + dump_data(100, (const char *)sess_key, 16); #endif } @@ -506,7 +506,7 @@ BOOL decode_pw_buffer(uint8 in_buffer[516], char *new_pwrd, byte_len = IVAL(in_buffer, 512); #ifdef DEBUG_PASSWORD - dump_data(100, in_buffer, 516); + dump_data(100, (const char *)in_buffer, 516); #endif /* Password cannot be longer than the size of the password buffer */ @@ -522,7 +522,7 @@ BOOL decode_pw_buffer(uint8 in_buffer[516], char *new_pwrd, #ifdef DEBUG_PASSWORD DEBUG(100,("decode_pw_buffer: new_pwrd: ")); - dump_data(100, (char *)new_pwrd, *new_pw_len); + dump_data(100, (const char *)new_pwrd, *new_pw_len); DEBUG(100,("multibyte len:%d\n", *new_pw_len)); DEBUG(100,("original char len:%d\n", byte_len/2)); #endif diff --git a/source3/libsmb/spnego.c b/source3/libsmb/spnego.c index 2cf3480fce..6cc4436a0c 100644 --- a/source3/libsmb/spnego.c +++ b/source3/libsmb/spnego.c @@ -45,9 +45,11 @@ static BOOL read_negTokenInit(ASN1_DATA *asn1, negTokenInit_t *token) token->mechTypes = SMB_MALLOC_P(const char *); for (i = 0; !asn1->has_error && 0 < asn1_tag_remaining(asn1); i++) { + char *p_oid = NULL; token->mechTypes = SMB_REALLOC_ARRAY(token->mechTypes, const char *, i + 2); - asn1_read_OID(asn1, &token->mechTypes[i]); + asn1_read_OID(asn1, &p_oid); + token->mechTypes[i] = p_oid; } token->mechTypes[i] = NULL; @@ -317,7 +319,7 @@ BOOL free_spnego_data(SPNEGO_DATA *spnego) if (spnego->negTokenInit.mechTypes) { int i; for (i = 0; spnego->negTokenInit.mechTypes[i]; i++) { - free(spnego->negTokenInit.mechTypes[i]); + free(CONST_DISCARD(char *,spnego->negTokenInit.mechTypes[i])); } free(spnego->negTokenInit.mechTypes); } diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c index 50fa613e72..87d20107fa 100644 --- a/source3/libsmb/trusts_util.c +++ b/source3/libsmb/trusts_util.c @@ -31,8 +31,8 @@ **********************************************************/ static NTSTATUS just_change_the_password(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - unsigned char orig_trust_passwd_hash[16], - unsigned char new_trust_passwd_hash[16], + const unsigned char orig_trust_passwd_hash[16], + const unsigned char new_trust_passwd_hash[16], uint32 sec_channel_type) { NTSTATUS result; 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; } 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) { diff --git a/source3/registry/reg_eventlog.c b/source3/registry/reg_eventlog.c index 69d8f2f9aa..61c73abd4b 100644 --- a/source3/registry/reg_eventlog.c +++ b/source3/registry/reg_eventlog.c @@ -226,7 +226,7 @@ BOOL eventlog_add_source( const char *eventlog, const char *sourcename, already_in = False; wrklist = NULL; - dump_data( 1, rval->data_p, rval->size ); + dump_data( 1, (const char *)rval->data_p, rval->size ); if ( ( numsources = regval_convert_multi_sz( ( uint16 * ) rval->data_p, rval->size, &wrklist ) ) > 0 ) { diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c index 609f86da6c..fe8b355b95 100644 --- a/source3/registry/reg_perfcount.c +++ b/source3/registry/reg_perfcount.c @@ -872,10 +872,10 @@ static uint32 _reg_perfcount_perf_data_block_fixup(PERF_DATA_BLOCK *block, prs_s counter_data->ByteLength = counter->CounterOffset + counter->CounterSize + sizeof(counter_data->ByteLength); temp = TALLOC_REALLOC_ARRAY(ps->mem_ctx, temp, - uint8, + char, counter_data->ByteLength- sizeof(counter_data->ByteLength)); memset(temp, 0, counter_data->ByteLength - sizeof(counter_data->ByteLength)); - src_addr = counter_data->data; + src_addr = (char *)counter_data->data; for(i = 0; i < object[obj].NumCounters; i++) { counter = &(object[obj].counters[i]); diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index 88b6c792eb..968c2182be 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -255,7 +255,7 @@ NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli, const char *server_name, const char *domain, const char *machine_account, - const char machine_pwd[16], + const unsigned char machine_pwd[16], uint32 sec_chan_type, uint32 *neg_flags_inout) { @@ -435,8 +435,8 @@ NTSTATUS rpccli_netlogon_sam_sync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c creds_client_step(cli->dc, &clnt_creds); - prs_set_session_key(&qbuf, cli->dc->sess_key); - prs_set_session_key(&rbuf, cli->dc->sess_key); + prs_set_session_key(&qbuf, (const char *)cli->dc->sess_key); + prs_set_session_key(&rbuf, (const char *)cli->dc->sess_key); init_net_q_sam_sync(&q, cli->dc->remote_machine, global_myname(), &clnt_creds, &ret_creds, database_id, next_rid); @@ -564,7 +564,7 @@ NTSTATUS rpccli_netlogon_sam_logon(struct rpc_pipe_client *cli, 0, /* param_ctrl */ 0xdead, 0xbeef, /* LUID? */ username, clnt_name_slash, - cli->dc->sess_key, lm_owf_user_pwd, + (const char *)cli->dc->sess_key, lm_owf_user_pwd, nt_owf_user_pwd); break; @@ -740,7 +740,7 @@ LSA Server Password Set. ****************************************************************************/ NTSTATUS rpccli_net_srv_pwset(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - const char *machine_name, uint8 hashed_mach_pwd[16]) + const char *machine_name, const uint8 hashed_mach_pwd[16]) { prs_struct rbuf; prs_struct qbuf; diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 3b411272c3..e1e502794c 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -250,7 +250,7 @@ static NTSTATUS cli_pipe_verify_ntlmssp(struct rpc_pipe_client *cli, RPC_HDR *pr data = (unsigned char *)(prs_data_p(current_pdu) + RPC_HEADER_LEN + RPC_HDR_RESP_LEN); data_len = (size_t)(prhdr->frag_len - RPC_HEADER_LEN - RPC_HDR_RESP_LEN - RPC_HDR_AUTH_LEN - auth_len); - full_packet_data = prs_data_p(current_pdu); + full_packet_data = (unsigned char *)prs_data_p(current_pdu); full_packet_data_len = prhdr->frag_len - auth_len; /* Pull the auth header and the following data into a blob. */ @@ -265,7 +265,7 @@ static NTSTATUS cli_pipe_verify_ntlmssp(struct rpc_pipe_client *cli, RPC_HDR *pr return NT_STATUS_BUFFER_TOO_SMALL; } - auth_blob.data = prs_data_p(current_pdu) + prs_offset(current_pdu); + auth_blob.data = (unsigned char *)prs_data_p(current_pdu) + prs_offset(current_pdu); auth_blob.length = auth_len; switch (cli->auth.auth_level) { @@ -1143,7 +1143,7 @@ static NTSTATUS create_bind_or_alt_ctx_internal(uint8 pkt_type, if(auth_len != 0) { if (ss_padding_len) { - unsigned char pad[8]; + char pad[8]; memset(pad, '\0', 8); if (!prs_copy_data_in(rpc_out, pad, ss_padding_len)) { DEBUG(0,("create_bind_or_alt_ctx_internal: failed to marshall padding.\n")); @@ -1272,9 +1272,9 @@ static NTSTATUS add_ntlmssp_auth_footer(struct rpc_pipe_client *cli, case PIPE_AUTH_LEVEL_PRIVACY: /* Data portion is encrypted. */ status = ntlmssp_seal_packet(cli->auth.a_u.ntlmssp_state, - prs_data_p(outgoing_pdu) + RPC_HEADER_LEN + RPC_HDR_RESP_LEN, + (unsigned char *)prs_data_p(outgoing_pdu) + RPC_HEADER_LEN + RPC_HDR_RESP_LEN, data_and_pad_len, - prs_data_p(outgoing_pdu), + (unsigned char *)prs_data_p(outgoing_pdu), (size_t)prs_offset(outgoing_pdu), &auth_blob); if (!NT_STATUS_IS_OK(status)) { @@ -1286,9 +1286,9 @@ static NTSTATUS add_ntlmssp_auth_footer(struct rpc_pipe_client *cli, case PIPE_AUTH_LEVEL_INTEGRITY: /* Data is signed. */ status = ntlmssp_sign_packet(cli->auth.a_u.ntlmssp_state, - prs_data_p(outgoing_pdu) + RPC_HEADER_LEN + RPC_HDR_RESP_LEN, + (unsigned char *)prs_data_p(outgoing_pdu) + RPC_HEADER_LEN + RPC_HDR_RESP_LEN, data_and_pad_len, - prs_data_p(outgoing_pdu), + (unsigned char *)prs_data_p(outgoing_pdu), (size_t)prs_offset(outgoing_pdu), &auth_blob); if (!NT_STATUS_IS_OK(status)) { @@ -1306,7 +1306,7 @@ static NTSTATUS add_ntlmssp_auth_footer(struct rpc_pipe_client *cli, /* Finally marshall the blob. */ - if (!prs_copy_data_in(outgoing_pdu, auth_blob.data, NTLMSSP_SIG_SIZE)) { + if (!prs_copy_data_in(outgoing_pdu, (const char *)auth_blob.data, NTLMSSP_SIG_SIZE)) { DEBUG(0,("add_ntlmssp_auth_footer: failed to add %u bytes auth blob.\n", (unsigned int)NTLMSSP_SIG_SIZE)); data_blob_free(&auth_blob); @@ -2391,7 +2391,7 @@ static struct rpc_pipe_client *get_schannel_session_key(struct cli_state *cli, uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS|NETLOGON_NEG_SCHANNEL; struct rpc_pipe_client *netlogon_pipe = NULL; uint32 sec_chan_type = 0; - char machine_pwd[16]; + unsigned char machine_pwd[16]; fstring machine_account; netlogon_pipe = cli_rpc_pipe_open_noauth(cli, PI_NETLOGON, perr); @@ -2513,7 +2513,7 @@ static struct rpc_pipe_client *get_schannel_session_key_auth_ntlmssp(struct cli_ uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS|NETLOGON_NEG_SCHANNEL; struct rpc_pipe_client *netlogon_pipe = NULL; uint32 sec_chan_type = 0; - char machine_pwd[16]; + unsigned char machine_pwd[16]; fstring machine_account; netlogon_pipe = cli_rpc_pipe_open_spnego_ntlmssp(cli, PI_NETLOGON, PIPE_AUTH_LEVEL_PRIVACY, domain, username, password, perr); diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index f4ba0e76a1..401daea39c 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -932,7 +932,7 @@ BOOL net_io_r_auth_3(const char *desc, NET_R_AUTH_3 *r_a, prs_struct *ps, int de void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, const char *logon_srv, const char *sess_key, const char *acct_name, uint16 sec_chan, const char *comp_name, - DOM_CRED *cred, uchar hashed_mach_pwd[16]) + DOM_CRED *cred, const uchar hashed_mach_pwd[16]) { unsigned char nt_cypher[16]; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 088c8f08fb..3742ac95be 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -1431,7 +1431,7 @@ BOOL prs_hash1(prs_struct *ps, uint32 offset, int len) dump_data(100, ps->sess_key, 16); dump_data(100, q, len); #endif - SamOEMhash((uchar *) q, ps->sess_key, len); + SamOEMhash((uchar *) q, (const unsigned char *)ps->sess_key, len); #ifdef DEBUG_PASSWORD dump_data(100, q, len); diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 1aaebf71e3..dfe80a65e2 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7050,12 +7050,12 @@ void init_samr_q_chgpasswd_user(SAMR_Q_CHGPASSWD_USER * q_u, init_unistr2(&q_u->uni_user_name, user_name, UNI_FLAGS_NONE); init_uni_hdr(&q_u->hdr_user_name, &q_u->uni_user_name); - init_enc_passwd(&q_u->nt_newpass, nt_newpass); + init_enc_passwd(&q_u->nt_newpass, (const char *)nt_newpass); init_enc_hash(&q_u->nt_oldhash, nt_oldhash); q_u->unknown = 0x01; - init_enc_passwd(&q_u->lm_newpass, lm_newpass); + init_enc_passwd(&q_u->lm_newpass, (const char *)lm_newpass); init_enc_hash(&q_u->lm_oldhash, lm_oldhash); } diff --git a/source3/rpc_server/srv_eventlog_lib.c b/source3/rpc_server/srv_eventlog_lib.c index 495ad8e58c..b21c2a2529 100644 --- a/source3/rpc_server/srv_eventlog_lib.c +++ b/source3/rpc_server/srv_eventlog_lib.c @@ -483,7 +483,7 @@ int write_eventlog_tdb( TDB_CONTEXT * the_tdb, Eventlog_entry * ee ) next_record = tdb_fetch_int32( the_tdb, EVT_NEXT_RECORD ); n_packed = - tdb_pack( packed_ee, ee->record.length + MARGIN, + tdb_pack( (char *)packed_ee, ee->record.length + MARGIN, "ddddddwwwwddddddBBdBBBd", ee->record.length, ee->record.reserved1, next_record, ee->record.time_generated, ee->record.time_written, @@ -512,10 +512,10 @@ int write_eventlog_tdb( TDB_CONTEXT * the_tdb, Eventlog_entry * ee ) /* increment the record count */ kbuf.dsize = sizeof( int32 ); - kbuf.dptr = ( uint8 * ) & next_record; + kbuf.dptr = (char * ) & next_record; ebuf.dsize = n_packed; - ebuf.dptr = packed_ee; + ebuf.dptr = (char *)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)); */ diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c index 2dd8b821d8..f75ad6bba0 100644 --- a/source3/rpc_server/srv_netlog_nt.c +++ b/source3/rpc_server/srv_netlog_nt.c @@ -337,7 +337,7 @@ NTSTATUS _net_auth(pipes_struct *p, NET_Q_AUTH *q_u, NET_R_AUTH *r_u) creds_server_init(p->dc, &p->dc->clnt_chal, /* Stored client chal. */ &p->dc->srv_chal, /* Stored server chal. */ - p->dc->mach_pw, + (const char *)p->dc->mach_pw, &srv_chal_out); /* Check client credentials are valid. */ @@ -414,7 +414,7 @@ NTSTATUS _net_auth_2(pipes_struct *p, NET_Q_AUTH_2 *q_u, NET_R_AUTH_2 *r_u) creds_server_init(p->dc, &p->dc->clnt_chal, /* Stored client chal. */ &p->dc->srv_chal, /* Stored server chal. */ - p->dc->mach_pw, + (const char *)p->dc->mach_pw, &srv_chal_out); /* Check client credentials are valid. */ diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 1ca5210842..b615080d34 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -173,7 +173,7 @@ static BOOL create_next_pdu_ntlmssp(pipes_struct *p) /* Copy the sign/seal padding data. */ if (ss_padding_len) { - unsigned char pad[8]; + char pad[8]; memset(pad, '\0', 8); if (!prs_copy_data_in(&outgoing_pdu, pad, ss_padding_len)) { @@ -210,9 +210,9 @@ static BOOL create_next_pdu_ntlmssp(pipes_struct *p) case PIPE_AUTH_LEVEL_PRIVACY: /* Data portion is encrypted. */ status = ntlmssp_seal_packet(a->ntlmssp_state, - prs_data_p(&outgoing_pdu) + RPC_HEADER_LEN + RPC_HDR_RESP_LEN, + (unsigned char *)prs_data_p(&outgoing_pdu) + RPC_HEADER_LEN + RPC_HDR_RESP_LEN, data_len + ss_padding_len, - prs_data_p(&outgoing_pdu), + (unsigned char *)prs_data_p(&outgoing_pdu), (size_t)prs_offset(&outgoing_pdu), &auth_blob); if (!NT_STATUS_IS_OK(status)) { @@ -224,9 +224,9 @@ static BOOL create_next_pdu_ntlmssp(pipes_struct *p) case PIPE_AUTH_LEVEL_INTEGRITY: /* Data is signed. */ status = ntlmssp_sign_packet(a->ntlmssp_state, - prs_data_p(&outgoing_pdu) + RPC_HEADER_LEN + RPC_HDR_RESP_LEN, + (unsigned char *)prs_data_p(&outgoing_pdu) + RPC_HEADER_LEN + RPC_HDR_RESP_LEN, data_len + ss_padding_len, - prs_data_p(&outgoing_pdu), + (unsigned char *)prs_data_p(&outgoing_pdu), (size_t)prs_offset(&outgoing_pdu), &auth_blob); if (!NT_STATUS_IS_OK(status)) { @@ -241,7 +241,7 @@ static BOOL create_next_pdu_ntlmssp(pipes_struct *p) } /* Append the auth blob. */ - if (!prs_copy_data_in(&outgoing_pdu, auth_blob.data, NTLMSSP_SIG_SIZE)) { + if (!prs_copy_data_in(&outgoing_pdu, (char *)auth_blob.data, NTLMSSP_SIG_SIZE)) { DEBUG(0,("create_next_pdu_ntlmssp: failed to add %u bytes auth blob.\n", (unsigned int)NTLMSSP_SIG_SIZE)); data_blob_free(&auth_blob); @@ -731,7 +731,7 @@ BOOL api_pipe_bind_auth3(pipes_struct *p, prs_struct *rpc_in_p) blob = data_blob(NULL,p->hdr.auth_len); - if (!prs_copy_data_out(blob.data, rpc_in_p, p->hdr.auth_len)) { + if (!prs_copy_data_out((char *)blob.data, rpc_in_p, p->hdr.auth_len)) { DEBUG(0,("api_pipe_bind_auth3: Failed to pull %u bytes - the response blob.\n", (unsigned int)p->hdr.auth_len )); goto err; @@ -1036,7 +1036,7 @@ static BOOL pipe_spnego_auth_bind_negotiate(pipes_struct *p, prs_struct *rpc_in_ /* Grab the SPNEGO blob. */ blob = data_blob(NULL,p->hdr.auth_len); - if (!prs_copy_data_out(blob.data, rpc_in_p, p->hdr.auth_len)) { + if (!prs_copy_data_out((char *)blob.data, rpc_in_p, p->hdr.auth_len)) { DEBUG(0,("pipe_spnego_auth_bind_negotiate: Failed to pull %u bytes - the SPNEGO auth header.\n", (unsigned int)p->hdr.auth_len )); goto err; @@ -1103,7 +1103,7 @@ static BOOL pipe_spnego_auth_bind_negotiate(pipes_struct *p, prs_struct *rpc_in_ goto err; } - if (!prs_copy_data_in(pout_auth, response.data, response.length)) { + if (!prs_copy_data_in(pout_auth, (char *)response.data, response.length)) { DEBUG(0,("pipe_spnego_auth_bind_negotiate: marshalling of data blob failed.\n")); goto err; } @@ -1154,7 +1154,7 @@ static BOOL pipe_spnego_auth_bind_continue(pipes_struct *p, prs_struct *rpc_in_p /* Grab the SPNEGO blob. */ spnego_blob = data_blob(NULL,p->hdr.auth_len); - if (!prs_copy_data_out(spnego_blob.data, rpc_in_p, p->hdr.auth_len)) { + if (!prs_copy_data_out((char *)spnego_blob.data, rpc_in_p, p->hdr.auth_len)) { DEBUG(0,("pipe_spnego_auth_bind_continue: Failed to pull %u bytes - the SPNEGO auth header.\n", (unsigned int)p->hdr.auth_len )); goto err; @@ -1306,13 +1306,13 @@ static BOOL pipe_ntlmssp_auth_bind(pipes_struct *p, prs_struct *rpc_in_p, /* Grab the NTLMSSP blob. */ blob = data_blob(NULL,p->hdr.auth_len); - if (!prs_copy_data_out(blob.data, rpc_in_p, p->hdr.auth_len)) { + if (!prs_copy_data_out((char *)blob.data, rpc_in_p, p->hdr.auth_len)) { DEBUG(0,("pipe_ntlmssp_auth_bind: Failed to pull %u bytes - the NTLM auth header.\n", (unsigned int)p->hdr.auth_len )); goto err; } - if (strncmp(blob.data, "NTLMSSP", 7) != 0) { + if (strncmp((char *)blob.data, "NTLMSSP", 7) != 0) { DEBUG(0,("pipe_ntlmssp_auth_bind: Failed to read NTLMSSP in blob\n")); goto err; } @@ -1341,7 +1341,7 @@ static BOOL pipe_ntlmssp_auth_bind(pipes_struct *p, prs_struct *rpc_in_p, goto err; } - if (!prs_copy_data_in(pout_auth, response.data, response.length)) { + if (!prs_copy_data_in(pout_auth, (char *)response.data, response.length)) { DEBUG(0,("pipe_ntlmssp_auth_bind: marshalling of data blob failed.\n")); goto err; } @@ -1896,7 +1896,7 @@ BOOL api_pipe_ntlmssp_auth_process(pipes_struct *p, prs_struct *rpc_in, return False; } - auth_blob.data = prs_data_p(rpc_in) + prs_offset(rpc_in); + auth_blob.data = (unsigned char *)prs_data_p(rpc_in) + prs_offset(rpc_in); auth_blob.length = auth_len; switch (p->auth.auth_level) { diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index 26a691e9b4..45a77197ee 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -1688,9 +1688,9 @@ NTSTATUS _samr_query_usergroups(pipes_struct *p, SAMR_Q_QUERY_USERGROUPS *q_u, S DOM_SID sid; DOM_SID *sids; DOM_GID *gids = NULL; - int num_groups = 0; + size_t num_groups = 0; gid_t *unix_gids; - int i, num_gids; + size_t i, num_gids; uint32 acc_granted; BOOL ret; NTSTATUS result; @@ -2988,10 +2988,10 @@ NTSTATUS _samr_set_userinfo2(pipes_struct *p, SAMR_Q_SET_USERINFO2 *q_u, SAMR_R_ NTSTATUS _samr_query_useraliases(pipes_struct *p, SAMR_Q_QUERY_USERALIASES *q_u, SAMR_R_QUERY_USERALIASES *r_u) { - int num_alias_rids; + size_t num_alias_rids; uint32 *alias_rids; struct samr_info *info = NULL; - int i; + size_t i; NTSTATUS ntstatus1; NTSTATUS ntstatus2; @@ -3052,9 +3052,8 @@ NTSTATUS _samr_query_useraliases(pipes_struct *p, SAMR_Q_QUERY_USERALIASES *q_u, NTSTATUS _samr_query_aliasmem(pipes_struct *p, SAMR_Q_QUERY_ALIASMEM *q_u, SAMR_R_QUERY_ALIASMEM *r_u) { - int i; - - int num_sids = 0; + size_t i; + size_t num_sids = 0; DOM_SID2 *sid; DOM_SID *sids=NULL; @@ -3165,7 +3164,7 @@ NTSTATUS _samr_query_groupmem(pipes_struct *p, SAMR_Q_QUERY_GROUPMEM *q_u, SAMR_ { DOM_SID group_sid; fstring group_sid_str; - int i, num_members; + size_t i, num_members; uint32 *rid=NULL; uint32 *attr=NULL; diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index a05c2c8a0b..665fe34226 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -579,7 +579,7 @@ static NTSTATUS cmd_samr_query_useraliases(struct rpc_pipe_client *cli, POLICY_HND connect_pol, domain_pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; DOM_SID *sids; - int num_sids; + size_t num_sids; uint32 num_aliases, *alias_rids; uint32 access_mask = MAXIMUM_ALLOWED_ACCESS; int i; diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index 0ae16e8f1a..688b7b520e 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -2059,13 +2059,13 @@ static WERROR cmd_spoolss_setprinterdata(struct rpc_pipe_client *cli, } value.size = len*2; - value.data_p = TALLOC_ARRAY(mem_ctx, char, value.size); + value.data_p = TALLOC_ARRAY(mem_ctx, unsigned char, value.size); if (value.data_p == NULL) { result = WERR_NOMEM; goto done; } - p = value.data_p; + p = (char *)value.data_p; len = value.size; for (i=4; i<argc; i++) { size_t l = (strlen(argv[i])+1)*2; diff --git a/source3/services/services_db.c b/source3/services/services_db.c index 9cd9ba8d83..477bf4e269 100644 --- a/source3/services/services_db.c +++ b/source3/services/services_db.c @@ -493,7 +493,7 @@ SEC_DESC* svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN * /* stream the printer security descriptor */ prs_init( &ps, 0, key, UNMARSHALL); - prs_give_memory( &ps, regval_data_p(val), regval_size(val), False ); + prs_give_memory( &ps, (char *)regval_data_p(val), regval_size(val), False ); if ( !sec_io_desc("sec_desc", &sd, &ps, 0 ) ) { regkey_close_internal( key ); diff --git a/source3/smbd/error.c b/source3/smbd/error.c index 3cdcae5c7f..fa236f0de0 100644 --- a/source3/smbd/error.c +++ b/source3/smbd/error.c @@ -26,7 +26,7 @@ extern struct unix_error_map unix_dos_nt_errmap[]; extern uint32 global_client_caps; /* these can be set by some functions to override the error codes */ static int override_ERR_class; -static int override_ERR_code; +static uint32 override_ERR_code; static NTSTATUS override_ERR_ntstatus; /**************************************************************************** diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index 0666fe8913..3e1174b22f 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -1797,8 +1797,8 @@ static BOOL api_NetUserGetGroups(connection_struct *conn,uint16 vuid, char *para BOOL ret = False; DOM_SID *sids; gid_t *gids; - int num_groups; - int i; + size_t num_groups; + size_t i; fstring grp_domain; fstring grp_name; enum SID_NAME_USE grp_type; diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index 91942bf028..65c31449bb 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -172,7 +172,7 @@ static int negprot_spnego(char *p, uint8 *pkeylen) DATA_BLOB blob; nstring dos_name; fstring unix_name; - uint8 guid[17]; + char guid[17]; const char *OIDs_krb5[] = {OID_KERBEROS5, OID_KERBEROS5_OLD, OID_NTLMSSP, @@ -186,7 +186,7 @@ static int negprot_spnego(char *p, uint8 *pkeylen) safe_strcpy(unix_name, global_myname(), sizeof(unix_name)-1); strlower_m(unix_name); push_ascii_nstring(dos_name, unix_name); - safe_strcpy((char *)guid, dos_name, sizeof(guid)-1); + safe_strcpy(guid, dos_name, sizeof(guid)-1); #ifdef DEVELOPER /* valgrind fixer... */ diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 47da903256..beed90f9aa 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2130,7 +2130,7 @@ void send_file_readbraw(connection_struct *conn, files_struct *fsp, SMB_OFF_T st DATA_BLOB header; _smb_setlen(outbuf,nread); - header.data = outbuf; + header.data = (uint8 *)outbuf; header.length = 4; header.free = NULL; @@ -2509,7 +2509,7 @@ int send_file_readX(connection_struct *conn, char *inbuf,char *outbuf,int length SSVAL(smb_buf(outbuf),-2,smb_maxcnt); SCVAL(outbuf,smb_vwv0,0xFF); set_message(outbuf,12,smb_maxcnt,False); - header.data = outbuf; + header.data = (uint8 *)outbuf; header.length = data - outbuf; header.free = NULL; diff --git a/source3/tdb/tdbdump.c b/source3/tdb/tdbdump.c index 3efb29e44c..6cac0bc5cc 100644 --- a/source3/tdb/tdbdump.c +++ b/source3/tdb/tdbdump.c @@ -34,7 +34,7 @@ static void print_data(TDB_DATA d) { - unsigned char *p = d.dptr; + unsigned char *p = (unsigned char *)d.dptr; int len = d.dsize; while (len--) { if (isprint(*p) && !strchr("\"\\", *p)) { diff --git a/source3/tdb/tdbtool.c b/source3/tdb/tdbtool.c index 8aa57af7ab..ce8490ea06 100644 --- a/source3/tdb/tdbtool.c +++ b/source3/tdb/tdbtool.c @@ -131,7 +131,7 @@ static int print_rec(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *st static int print_key(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state); static int print_hexkey(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state); -static void print_asc(unsigned char *buf,int len) +static void print_asc(const char *buf,int len) { int i; @@ -145,7 +145,7 @@ static void print_asc(unsigned char *buf,int len) printf("%c",isprint(buf[i])?buf[i]:'.'); } -static void print_data(unsigned char *buf,int len) +static void print_data(const char *buf,int len) { int i=0; if (len<=0) return; diff --git a/source3/tdb/tdbutil.c b/source3/tdb/tdbutil.c index e27880e5ea..ac9280cf8b 100644 --- a/source3/tdb/tdbutil.c +++ b/source3/tdb/tdbutil.c @@ -505,7 +505,7 @@ BOOL tdb_pack_append(TALLOC_CTX *mem_ctx, uint8_t **buf, size_t *len, return False; va_start(ap, fmt); - len2 = tdb_pack_va((*buf)+(*len), len1, fmt, ap); + len2 = tdb_pack_va((char *)(*buf)+(*len), len1, fmt, ap); va_end(ap); if (len1 != len2) diff --git a/source3/utils/net_ads_cldap.c b/source3/utils/net_ads_cldap.c index 9585a8bc76..9f70a5b725 100644 --- a/source3/utils/net_ads_cldap.c +++ b/source3/utils/net_ads_cldap.c @@ -202,7 +202,7 @@ static int recv_cldap_netlogon(int sock, struct cldap_netlogon_reply *reply) ASN1_DATA data; DATA_BLOB blob; DATA_BLOB os1, os2, os3; - uint32 i1; + int i1; char *p; blob = data_blob(NULL, 8192); diff --git a/source3/utils/net_groupmap.c b/source3/utils/net_groupmap.c index b08673b2bb..12c3c79ef4 100644 --- a/source3/utils/net_groupmap.c +++ b/source3/utils/net_groupmap.c @@ -109,9 +109,9 @@ static void print_map_entry ( GROUP_MAP map, BOOL long_list ) **********************************************************/ static int net_groupmap_list(int argc, const char **argv) { - int entries; + size_t entries; BOOL long_list = False; - int i; + size_t i; fstring ntgroup = ""; fstring sid_string = ""; @@ -597,7 +597,7 @@ static int net_groupmap_set(int argc, const char **argv) static int net_groupmap_cleanup(int argc, const char **argv) { GROUP_MAP *map = NULL; - int i, entries; + size_t i, entries; if (!pdb_enum_group_mapping(SID_NAME_UNKNOWN, &map, &entries, ENUM_ALL_MAPPED)) { @@ -670,7 +670,7 @@ static int net_groupmap_listmem(int argc, const char **argv) { DOM_SID alias; DOM_SID *members; - int i, num; + size_t i, num; if ( (argc != 1) || !string_to_sid(&alias, argv[0]) ) { @@ -697,7 +697,7 @@ static BOOL print_alias_memberships(TALLOC_CTX *mem_ctx, const DOM_SID *member) { uint32 *alias_rids; - int i, num_alias_rids; + size_t i, num_alias_rids; alias_rids = NULL; num_alias_rids = 0; diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c index 7abb31ab3d..0ee180e13e 100644 --- a/source3/utils/net_idmap.c +++ b/source3/utils/net_idmap.c @@ -76,8 +76,8 @@ static int net_idmap_dump(int argc, const char **argv) struct hwms { BOOL ok; - int user_hwm; - int group_hwm; + uid_t user_hwm; + gid_t group_hwm; }; static int net_idmap_find_max_id(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA data, @@ -160,8 +160,8 @@ static NTSTATUS net_idmap_fixup_hwm(void) goto done; } - if ((tdb_store_int32(idmap_tdb, "USER HWM", hwms.user_hwm) != 0) || - (tdb_store_int32(idmap_tdb, "GROUP HWM", hwms.group_hwm) != 0)) { + if ((tdb_store_int32(idmap_tdb, "USER HWM", (int32)hwms.user_hwm) != 0) || + (tdb_store_int32(idmap_tdb, "GROUP HWM", (int32)hwms.group_hwm) != 0)) { d_printf("Could not store HWMs\n"); goto done; } diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 54af5c4df1..33eac56a92 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -4800,7 +4800,7 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid, LOGON_HRS hrs; uchar pwbuf[516]; - encode_pw_buffer((char *)pwbuf, argv[1], STR_UNICODE); + encode_pw_buffer(pwbuf, argv[1], STR_UNICODE); ZERO_STRUCT(ctr); ZERO_STRUCT(p23); diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c index 33ccb6c1b7..7397c88d95 100644 --- a/source3/utils/net_rpc_registry.c +++ b/source3/utils/net_rpc_registry.c @@ -357,7 +357,7 @@ static BOOL write_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk, for ( i=0; i<nk->num_values; i++ ) { regval_ctr_addvalue( values, nk->values[i].valuename, nk->values[i].type, - nk->values[i].data, (nk->values[i].data_size & ~VK_DATA_IN_OFFSET) ); + (const char *)nk->values[i].data, (nk->values[i].data_size & ~VK_DATA_IN_OFFSET) ); } /* copy subkeys into the REGSUBKEY_CTR */ diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 4f3bb4d414..41203dac74 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -755,7 +755,7 @@ static void offer_gss_spnego_mechs(void) { /* Server negTokenInit (mech offerings) */ spnego.type = SPNEGO_NEG_TOKEN_INIT; - spnego.negTokenInit.mechTypes = SMB_XMALLOC_ARRAY(char *, 2); + spnego.negTokenInit.mechTypes = SMB_XMALLOC_ARRAY(const char *, 2); #ifdef HAVE_KRB5 spnego.negTokenInit.mechTypes[0] = smb_xstrdup(OID_KERBEROS5_OLD); spnego.negTokenInit.mechTypes[1] = smb_xstrdup(OID_NTLMSSP); @@ -1056,7 +1056,7 @@ static BOOL manage_client_ntlmssp_init(SPNEGO_DATA spnego) } spnego.type = SPNEGO_NEG_TOKEN_INIT; - spnego.negTokenInit.mechTypes = CONST_DISCARD(char **,my_mechs); + spnego.negTokenInit.mechTypes = my_mechs; spnego.negTokenInit.reqFlags = 0; spnego.negTokenInit.mechListMIC = null_blob; diff --git a/source3/utils/ntlm_auth_diagnostics.c b/source3/utils/ntlm_auth_diagnostics.c index 7fae0ede97..95f1355c2e 100644 --- a/source3/utils/ntlm_auth_diagnostics.c +++ b/source3/utils/ntlm_auth_diagnostics.c @@ -476,7 +476,7 @@ static BOOL test_plaintext(enum ntlm_break break_which) SAFE_FREE(password); - lm_response.length = strlen(lm_response.data); + lm_response.length = strlen((const char *)lm_response.data); switch (break_which) { case BREAK_NONE: diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c index dacaa1e26f..6e08712bc4 100644 --- a/source3/utils/pdbedit.c +++ b/source3/utils/pdbedit.c @@ -100,7 +100,7 @@ static int export_database (struct pdb_context *in, struct pdb_context static int export_groups (struct pdb_context *in, struct pdb_context *out) { GROUP_MAP *maps = NULL; - int i, entries = 0; + size_t i, entries = 0; if (NT_STATUS_IS_ERR(in->pdb_enum_group_mapping(in, SID_NAME_UNKNOWN, &maps, &entries, diff --git a/source3/utils/profiles.c b/source3/utils/profiles.c index 6bf9e44a14..05971b0d2e 100644 --- a/source3/utils/profiles.c +++ b/source3/utils/profiles.c @@ -96,7 +96,7 @@ static BOOL copy_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk, for ( i=0; i<nk->num_values; i++ ) { regval_ctr_addvalue( values, nk->values[i].valuename, nk->values[i].type, - nk->values[i].data, (nk->values[i].data_size & ~VK_DATA_IN_OFFSET) ); + (const char *)nk->values[i].data, (nk->values[i].data_size & ~VK_DATA_IN_OFFSET) ); } /* copy subkeys into the REGSUBKEY_CTR */ |