smb_ucs2_t *buffer = NULL;
size = convert_string_allocate(NULL, CH_UNIX, CH_UCS2, src, srclen,
- (void **) &buffer, True);
+ (void **)(void *)&buffer, True);
if (size == (size_t)-1 || !buffer) {
smb_panic("failed to create UCS2 buffer");
}
* (This is not redundant with the clobbering above. The
* marking might not actually take effect if we're not running
* under valgrind.) */
- VALGRIND_MAKE_WRITABLE(dest, len);
+// VALGRIND_MAKE_WRITABLE(dest, len);
#endif /* VALGRIND */
#endif /* DEVELOPER */
}
const unsigned char *p;
uint32 crc;
- p = buf;
+ p = (const unsigned char *)buf;
crc = ~0U;
while (size--)
char **file_lines_load(const char *fname, int *numlines)
{
char *p;
- size_t size;
+ size_t size = 0;
p = file_load(fname, &size);
if (!p) {
goto done;
}
- rc = ads_search_retry(ads, (void **)&msg, ldap_exp, attr);
+ rc = ads_search_retry(ads, (void **)(void *)&msg, ldap_exp, attr);
if (!ADS_ERR_OK(rc)) {
DEBUG(1,("ads_sid_to_dn ads_search: %s\n", ads_errstr(rc)));
if (asprintf(&filter, "(samAccountName=%s$)", machine_name) == -1) {
return kvno;
}
- ret = ads_search(ads, (void**) &res, filter, attrs);
+ ret = ads_search(ads, (void**)(void *)&res, filter, attrs);
SAFE_FREE(filter);
if (!ADS_ERR_OK(ret) && ads_count_replies(ads, res)) {
DEBUG(1,("ads_get_kvno: Computer Account For %s not found.\n", machine_name));
ADS_STATUS ret = ADS_ERROR(LDAP_SUCCESS);
char *dn_string = NULL;
- ret = ads_find_machine_acct(ads, (void **)&res, machine_name);
+ ret = ads_find_machine_acct(ads, (void **)(void *)&res, machine_name);
if (!ADS_ERR_OK(ret) || ads_count_replies(ads, res) != 1) {
DEBUG(5,("ads_clear_service_principal_names: WARNING: Host Account for %s not found... skipping operation.\n", machine_name));
DEBUG(5,("ads_clear_service_principal_names: WARNING: Service Principals for %s have NOT been cleared.\n", machine_name));
char *dn_string = NULL;
const char *servicePrincipalName[4] = {NULL, NULL, NULL, NULL};
- ret = ads_find_machine_acct(ads, (void **)&res, machine_name);
+ ret = ads_find_machine_acct(ads, (void **)(void *)&res, machine_name);
if (!ADS_ERR_OK(ret) || ads_count_replies(ads, res) != 1) {
DEBUG(1,("ads_add_service_principal_name: WARNING: Host Account for %s not found... skipping operation.\n",
machine_name));
name_to_fqdn(my_fqdn, machine_name);
- status = ads_find_machine_acct(ads, (void **)&res, machine_name);
+ status = ads_find_machine_acct(ads, (void **)(void *)&res, machine_name);
if (ADS_ERR_OK(status) && ads_count_replies(ads, res) == 1) {
char *dn_string = ads_get_dn(ads, res);
if (!dn_string) {
return status;
}
- status = ads_find_machine_acct(ads, (void **)&res, machine);
+ status = ads_find_machine_acct(ads, (void **)(void *)&res, machine);
if (!ADS_ERR_OK(status)) {
DEBUG(0, ("ads_join_realm: Host account test failed for machine %s\n", machine));
SAFE_FREE(machine);
p = smb_buf(cli->outbuf);
*p++ = 1;
- if ((lendos = (int)convert_string_allocate(NULL,CH_UNIX, CH_DOS, msg,len, (void **) &msgdos, True)) < 0 || !msgdos) {
+ if ((lendos = (int)convert_string_allocate(NULL,CH_UNIX, CH_DOS, msg,len, (void **)(void *)&msgdos, True)) < 0 || !msgdos) {
DEBUG(3,("Conversion failed, sending message in UNIX charset\n"));
SSVAL(p, 0, len); p += 2;
memcpy(p, msg, len);
prs_init( &ps, RPC_MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
- if ( !prs_uint32( "timestamp", &ps, 0, (uint32*)&t ) )
- return False;
+ {
+ uint32 ts;
+ if ( !prs_uint32( "timestamp", &ps, 0, &ts ) )
+ return False;
+ t = (time_t)ts;
+ }
if ( net_io_user_info3("", user, &ps, 0, 3, 0) )
{
{
struct name_record *oldrec = NULL;
- ubi_trInsert( subrec->namelist, namerec, &(namerec->name), &oldrec );
+ ubi_trInsert( subrec->namelist, namerec, &namerec->name, &oldrec );
if( oldrec ) {
SAFE_FREE( oldrec->data.ip );
SAFE_FREE( oldrec );
{
DOM_SID *dyn_sid;
fstring key;
- size_t size;
+ size_t size = 0;
slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_SID, domain);
strupper_m(key);
if (dyn_sid == NULL)
return False;
- if (size != sizeof(DOM_SID))
- {
+ if (size != sizeof(DOM_SID)) {
SAFE_FREE(dyn_sid);
return False;
}
{
struct uuid *dyn_guid;
fstring key;
- size_t size;
+ size_t size = 0;
struct uuid new_guid;
slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_GUID, domain);
return False;
}
- if (size != sizeof(struct uuid))
- {
+ if (size != sizeof(struct uuid)) {
DEBUG(1,("UUID size %d is wrong!\n", (int)size));
SAFE_FREE(dyn_guid);
return False;
{
struct machine_acct_pass *pass;
char *plaintext;
- size_t size;
+ size_t size = 0;
plaintext = secrets_fetch_machine_password(domain, pass_last_set_time,
channel);
DOM_SID *sid, time_t *pass_last_set_time)
{
struct trusted_dom_pass pass;
- size_t size;
+ size_t size = 0;
/* unpacking structures */
char* pass_buf;
BOOL fetch_ldap_pw(char **dn, char** pw)
{
char *key = NULL;
- size_t size;
+ size_t size = 0;
*dn = smb_xstrdup(lp_ldap_admin_dn());
char *pattern;
unsigned int start_idx;
uint32 idx = 0;
- size_t size, packed_size = 0;
+ size_t size = 0, packed_size = 0;
fstring dom_name;
char *packed_pass;
struct trusted_dom_pass *pass = TALLOC_ZERO_P(ctx, struct trusted_dom_pass);
{
fstring key;
struct afs_keyfile *keyfile;
- size_t size;
+ size_t size = 0;
uint32 i;
slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_AFS_KEYFILE, cell);
if (!prs_uint32("ptr_dc_address", ps, depth, &r_t->ptr_dc_address))
return False;
- if (!prs_uint32("dc_address_type", ps, depth, &r_t->dc_address_type))
+ if (!prs_int32("dc_address_type", ps, depth, &r_t->dc_address_type))
return False;
if (!smb_io_uuid("domain_guid", &r_t->domain_guid, ps, depth))
return True;
}
+/*******************************************************************
+ Stream an int32.
+ ********************************************************************/
+
+BOOL prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32)
+{
+ char *q = prs_mem_get(ps, sizeof(int32));
+ if (q == NULL)
+ return False;
+
+ if (UNMARSHALLING(ps)) {
+ if (ps->bigendian_data)
+ *data32 = RIVALS(q,0);
+ else
+ *data32 = IVALS(q,0);
+ } else {
+ if (ps->bigendian_data)
+ RSIVALS(q,0,*data32);
+ else
+ SIVALS(q,0,*data32);
+ }
+
+ DEBUG(5,("%s%04x %s: %08x\n", tab_depth(depth), ps->data_offset, name, *data32));
+
+ ps->data_offset += sizeof(int32);
+
+ return True;
+}
+
/*******************************************************************
Stream a NTSTATUS
********************************************************************/
{
EVENTLOG_INFO *info;
- if ( !find_policy_by_hnd( p, handle, ( void ** ) &info ) ) {
+ if ( !find_policy_by_hnd( p, handle, (void **)(void *)&info ) ) {
DEBUG( 2,
( "find_eventlog_info_by_hnd: eventlog not found.\n" ) );
return NULL;
uint32 num_domains;
NTSTATUS nt_status;
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
/* check if the user have enough rights */
r_u->status = NT_STATUS_OK;
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&handle))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
return NT_STATUS_INVALID_HANDLE;
switch (q_u->info_class) {
ref = TALLOC_ZERO_P(p->mem_ctx, DOM_R_REF);
names = TALLOC_ZERO_P(p->mem_ctx, LSA_TRANS_NAME_ENUM);
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&handle)) {
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle)) {
r_u->status = NT_STATUS_INVALID_HANDLE;
goto done;
}
ref = TALLOC_ZERO_P(p->mem_ctx, DOM_R_REF);
rids = TALLOC_ZERO_ARRAY(p->mem_ctx, DOM_RID2, num_entries);
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&handle)) {
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle)) {
r_u->status = NT_STATUS_INVALID_HANDLE;
goto done;
}
DEBUG(10,("_lsa_enum_privs: enum_context:%d total entries:%d\n",
enum_context, num_privs));
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&handle))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
return NT_STATUS_INVALID_HANDLE;
/* check if the user have enough rights
fstring name_asc;
const char *description;
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&handle))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
return NT_STATUS_INVALID_HANDLE;
/* check if the user have enough rights */
LSA_SID_ENUM *sids=&r_u->sids;
NTSTATUS ret;
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&handle))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
return NT_STATUS_INVALID_HANDLE;
if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
struct lsa_info *info;
/* find the connection policy handle. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&handle))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
return NT_STATUS_INVALID_HANDLE;
/* check if the user have enough rights */
struct lsa_info *info;
/* find the connection policy handle. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&handle))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
return NT_STATUS_INVALID_HANDLE;
/* check if the user have enough rights */
PRIVILEGE_SET privileges;
/* find the connection policy handle. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
if ( !get_privileges_for_sids( &mask, &info->sid, 1 ) )
/* find the connection policy handle. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
if (!lookup_sid(&info->sid, dom_name, name, &type))
r_u->status = NT_STATUS_OK;
/* find the connection policy handle. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
/* check to see if the pipe_user is a Domain Admin since
struct current_user user;
/* find the connection policy handle. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
/* check to see if the pipe_user is root or a Domain Admin since
struct current_user user;
/* find the connection policy handle. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
/* check to see if the pipe_user is root or a Domain Admin since
r_u->status = NT_STATUS_OK;
/* find the connection policy handle. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&handle))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
return NT_STATUS_INVALID_HANDLE;
/* check if the user have enough rights */
ZERO_STRUCT(guid);
r_u->status = NT_STATUS_OK;
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&handle))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
return NT_STATUS_INVALID_HANDLE;
switch (q_u->info_class) {
/* find the connection policy handle. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
/* check to see if the pipe_user is a Domain Admin since
/* find the connection policy handle. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
/* check to see if the pipe_user is a Domain Admin since
/* find the connection policy handle. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
/* according to an NT4 PDC, you can add privileges to SIDs even without
/* find the connection policy handle. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
unistr2_to_ascii(name, &q_u->privname.unistring, sizeof(name));
{
REGISTRY_KEY *regkey = NULL;
- if(!find_policy_by_hnd(p,hnd,(void **)®key)) {
+ if(!find_policy_by_hnd(p,hnd,(void **)(void *)®key)) {
DEBUG(2,("find_regkey_index_by_hnd: Registry Key not found: "));
return NULL;
}
/* find the connection policy handle. */
- if ( !find_policy_by_hnd(p, &q_u->pol, (void**)&info) )
+ if ( !find_policy_by_hnd(p, &q_u->pol, (void**)(void *)&info) )
return NT_STATUS_INVALID_HANDLE;
status = access_check_samr_function( info->acc_granted,
r_u->status = NT_STATUS_OK;
/* find the policy handle. open a policy on it. */
- if (!find_policy_by_hnd(p, &q_u->user_pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->user_pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
if (!sid_check_is_in_our_domain(&info->sid))
struct samr_info *info = NULL;
/* find the policy handle. open a policy on it. */
- if (!find_policy_by_hnd(p, pol, (void **)&info))
+ if (!find_policy_by_hnd(p, pol, (void **)(void *)&info))
return False;
if (!info)
r_u->status = NT_STATUS_OK;
/* find the policy handle. open a policy on it. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
if (!NT_STATUS_IS_OK(r_u->status = access_check_samr_function(info->acc_granted,
r_u->status = NT_STATUS_OK;
/* find the policy handle. open a policy on it. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
r_u->status = access_check_samr_function(info->acc_granted,
uint32 num_aliases = 0;
/* find the policy handle. open a policy on it. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
r_u->status = access_check_samr_function(info->acc_granted,
r_u->status = NT_STATUS_UNSUCCESSFUL;
/* find the policy handle. open a policy on it. */
- if (!find_policy_by_hnd(p, &q_u->domain_pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->domain_pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
/*
r_u->status=NT_STATUS_OK;
/* search for the handle */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
domain_sid = info->sid;
DEBUG(5,("_samr_query_dom_info: %d\n", __LINE__));
/* find the policy handle. open a policy on it. */
- if (!find_policy_by_hnd(p, &q_u->domain_pol, (void **)&info)) {
+ if (!find_policy_by_hnd(p, &q_u->domain_pol, (void **)(void *)&info)) {
return NT_STATUS_INVALID_HANDLE;
}
/* AS ROOT !!! */
- pdb_get_account_policy(AP_TIME_TO_LOGOUT, (unsigned int *)&u_logout);
+ {
+ uint32 ul;
+ pdb_get_account_policy(AP_TIME_TO_LOGOUT, &ul);
+ u_logout = (time_t)ul;
+ }
/* !AS ROOT */
r_u->status = NT_STATUS_OK;
- if (!find_policy_by_hnd(p, &q_u->connect_pol, (void**)&info))
+ if (!find_policy_by_hnd(p, &q_u->connect_pol, (void**)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
/* win9x user manager likes to use SA_RIGHT_SAM_ENUM_DOMAINS here.
r_u->status = NT_STATUS_OK;
- if (!find_policy_by_hnd(p, &q_u->pol, (void**)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void**)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
if (!NT_STATUS_IS_OK(r_u->status = access_check_samr_function(info->acc_granted, SA_RIGHT_SAM_ENUM_DOMAINS, "_samr_enum_domains"))) {
DEBUG(5,("_samr_query_useraliases: %d\n", __LINE__));
/* find the policy handle. open a policy on it. */
- if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
ntstatus1 = access_check_samr_function(info->acc_granted, SA_RIGHT_DOMAIN_LOOKUP_ALIAS_BY_MEM, "_samr_query_useraliases");
DEBUG(5,("_samr_query_domain_info2: %d\n", __LINE__));
/* find the policy handle. open a policy on it. */
- if (!find_policy_by_hnd(p, &q_u->domain_pol, (void **)&info))
+ if (!find_policy_by_hnd(p, &q_u->domain_pol, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
switch (q_u->switch_value) {
{
Printer_entry *find_printer = NULL;
- if(!find_policy_by_hnd(p,hnd,(void **)&find_printer)) {
+ if(!find_policy_by_hnd(p,hnd,(void **)(void *)&find_printer)) {
DEBUG(2,("find_printer_index_by_hnd: Printer handle not found: "));
return NULL;
}
{
SERVICE_INFO *service_info = NULL;
- if( !find_policy_by_hnd( p, hnd, (void **)&service_info) ) {
+ if( !find_policy_by_hnd( p, hnd, (void **)(void *)&service_info) ) {
DEBUG(2,("find_service_info_by_hnd: handle not found"));
return NULL;
}
* Incoming message is in DOS codepage format. Convert to UNIX.
*/
- if ((len = (int)convert_string_allocate(NULL,CH_DOS, CH_UNIX, msgbuf, msgpos, (void **) &msg, True)) < 0 || !msg) {
+ if ((len = (int)convert_string_allocate(NULL,CH_DOS, CH_UNIX, msgbuf, msgpos, (void **)(void *)&msg, True)) < 0 || !msg) {
DEBUG(3,("Conversion failed, delivering message in DOS codepage format\n"));
for (i = 0; i < msgpos;) {
if (msgbuf[i] == '\r' && i < (msgpos-1) && msgbuf[i+1] == '\n') {