diff options
72 files changed, 222 insertions, 213 deletions
diff --git a/source4/auth/auth.c b/source4/auth/auth.c index 57e2c050c1..b74bbc3371 100644 --- a/source4/auth/auth.c +++ b/source4/auth/auth.c @@ -443,9 +443,8 @@ static int num_backends; The 'name' can be later used by other backends to find the operations structure for this backend. */ -NTSTATUS auth_register(const void *_ops) +NTSTATUS auth_register(const struct auth_operations *ops) { - const struct auth_operations *ops = _ops; struct auth_operations *new_ops; if (auth_backend_byname(ops->name) != NULL) { diff --git a/source4/auth/gensec/gensec_krb5.c b/source4/auth/gensec/gensec_krb5.c index a64da5128f..811e562353 100644 --- a/source4/auth/gensec/gensec_krb5.c +++ b/source4/auth/gensec/gensec_krb5.c @@ -500,7 +500,7 @@ static NTSTATUS gensec_krb5_update(struct gensec_security *gensec_security, static NTSTATUS gensec_krb5_session_key(struct gensec_security *gensec_security, DATA_BLOB *session_key) { - struct gensec_krb5_state *gensec_krb5_state = gensec_security->private_data; + struct gensec_krb5_state *gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data; krb5_context context = gensec_krb5_state->smb_krb5_context->krb5_context; krb5_auth_context auth_context = gensec_krb5_state->auth_context; krb5_keyblock *skey; @@ -539,7 +539,7 @@ static NTSTATUS gensec_krb5_session_info(struct gensec_security *gensec_security struct auth_session_info **_session_info) { NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL; - struct gensec_krb5_state *gensec_krb5_state = gensec_security->private_data; + struct gensec_krb5_state *gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data; krb5_context context = gensec_krb5_state->smb_krb5_context->krb5_context; struct auth_serversupplied_info *server_info = NULL; struct auth_session_info *session_info = NULL; @@ -666,7 +666,7 @@ static NTSTATUS gensec_krb5_wrap(struct gensec_security *gensec_security, const DATA_BLOB *in, DATA_BLOB *out) { - struct gensec_krb5_state *gensec_krb5_state = gensec_security->private_data; + struct gensec_krb5_state *gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data; krb5_context context = gensec_krb5_state->smb_krb5_context->krb5_context; krb5_auth_context auth_context = gensec_krb5_state->auth_context; krb5_error_code ret; @@ -696,7 +696,7 @@ static NTSTATUS gensec_krb5_unwrap(struct gensec_security *gensec_security, const DATA_BLOB *in, DATA_BLOB *out) { - struct gensec_krb5_state *gensec_krb5_state = gensec_security->private_data; + struct gensec_krb5_state *gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data; krb5_context context = gensec_krb5_state->smb_krb5_context->krb5_context; krb5_auth_context auth_context = gensec_krb5_state->auth_context; krb5_error_code ret; @@ -725,7 +725,7 @@ static NTSTATUS gensec_krb5_unwrap(struct gensec_security *gensec_security, static BOOL gensec_krb5_have_feature(struct gensec_security *gensec_security, uint32_t feature) { - struct gensec_krb5_state *gensec_krb5_state = gensec_security->private_data; + struct gensec_krb5_state *gensec_krb5_state = (struct gensec_krb5_state *)gensec_security->private_data; if (feature & GENSEC_FEATURE_SESSION_KEY) { return True; } diff --git a/source4/auth/gensec/schannel.c b/source4/auth/gensec/schannel.c index 5dc5c287ec..6882eab945 100644 --- a/source4/auth/gensec/schannel.c +++ b/source4/auth/gensec/schannel.c @@ -44,7 +44,7 @@ static NTSTATUS schannel_session_key(struct gensec_security *gensec_security, static NTSTATUS schannel_update(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx, const DATA_BLOB in, DATA_BLOB *out) { - struct schannel_state *state = gensec_security->private_data; + struct schannel_state *state = (struct schannel_state *)gensec_security->private_data; NTSTATUS status; struct schannel_bind bind_schannel; struct schannel_bind_ack bind_schannel_ack; @@ -207,7 +207,7 @@ static NTSTATUS schannel_server_start(struct gensec_security *gensec_security) return status; } - state = gensec_security->private_data; + state = (struct schannel_state *)gensec_security->private_data; state->initiator = False; return NT_STATUS_OK; @@ -223,7 +223,7 @@ static NTSTATUS schannel_client_start(struct gensec_security *gensec_security) return status; } - state = gensec_security->private_data; + state = (struct schannel_state *)gensec_security->private_data; state->initiator = True; return NT_STATUS_OK; diff --git a/source4/auth/gensec/spnego.c b/source4/auth/gensec/spnego.c index 88521b912c..009d95a3d2 100644 --- a/source4/auth/gensec/spnego.c +++ b/source4/auth/gensec/spnego.c @@ -92,7 +92,7 @@ static NTSTATUS gensec_spnego_unseal_packet(struct gensec_security *gensec_secur const uint8_t *whole_pdu, size_t pdu_length, const DATA_BLOB *sig) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (spnego_state->state_position != SPNEGO_DONE && spnego_state->state_position != SPNEGO_FALLBACK) { @@ -112,7 +112,7 @@ static NTSTATUS gensec_spnego_check_packet(struct gensec_security *gensec_securi const uint8_t *whole_pdu, size_t pdu_length, const DATA_BLOB *sig) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (spnego_state->state_position != SPNEGO_DONE && spnego_state->state_position != SPNEGO_FALLBACK) { @@ -132,7 +132,7 @@ static NTSTATUS gensec_spnego_seal_packet(struct gensec_security *gensec_securit const uint8_t *whole_pdu, size_t pdu_length, DATA_BLOB *sig) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (spnego_state->state_position != SPNEGO_DONE && spnego_state->state_position != SPNEGO_FALLBACK) { @@ -152,7 +152,7 @@ static NTSTATUS gensec_spnego_sign_packet(struct gensec_security *gensec_securit const uint8_t *whole_pdu, size_t pdu_length, DATA_BLOB *sig) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (spnego_state->state_position != SPNEGO_DONE && spnego_state->state_position != SPNEGO_FALLBACK) { @@ -171,7 +171,7 @@ static NTSTATUS gensec_spnego_wrap(struct gensec_security *gensec_security, const DATA_BLOB *in, DATA_BLOB *out) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (spnego_state->state_position != SPNEGO_DONE && spnego_state->state_position != SPNEGO_FALLBACK) { @@ -188,7 +188,7 @@ static NTSTATUS gensec_spnego_unwrap(struct gensec_security *gensec_security, const DATA_BLOB *in, DATA_BLOB *out) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (spnego_state->state_position != SPNEGO_DONE && spnego_state->state_position != SPNEGO_FALLBACK) { @@ -206,7 +206,7 @@ static NTSTATUS gensec_spnego_wrap_packets(struct gensec_security *gensec_securi DATA_BLOB *out, size_t *len_processed) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (spnego_state->state_position != SPNEGO_DONE && spnego_state->state_position != SPNEGO_FALLBACK) { @@ -222,7 +222,7 @@ static NTSTATUS gensec_spnego_wrap_packets(struct gensec_security *gensec_securi static NTSTATUS gensec_spnego_packet_full_request(struct gensec_security *gensec_security, DATA_BLOB blob, size_t *size) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (spnego_state->state_position != SPNEGO_DONE && spnego_state->state_position != SPNEGO_FALLBACK) { @@ -240,7 +240,7 @@ static NTSTATUS gensec_spnego_unwrap_packets(struct gensec_security *gensec_secu DATA_BLOB *out, size_t *len_processed) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (spnego_state->state_position != SPNEGO_DONE && spnego_state->state_position != SPNEGO_FALLBACK) { @@ -255,7 +255,7 @@ static NTSTATUS gensec_spnego_unwrap_packets(struct gensec_security *gensec_secu static size_t gensec_spnego_sig_size(struct gensec_security *gensec_security, size_t data_size) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (spnego_state->state_position != SPNEGO_DONE && spnego_state->state_position != SPNEGO_FALLBACK) { @@ -267,7 +267,7 @@ static size_t gensec_spnego_sig_size(struct gensec_security *gensec_security, si static size_t gensec_spnego_max_input_size(struct gensec_security *gensec_security) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (spnego_state->state_position != SPNEGO_DONE && spnego_state->state_position != SPNEGO_FALLBACK) { @@ -279,7 +279,7 @@ static size_t gensec_spnego_max_input_size(struct gensec_security *gensec_securi static size_t gensec_spnego_max_wrapped_size(struct gensec_security *gensec_security) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (spnego_state->state_position != SPNEGO_DONE && spnego_state->state_position != SPNEGO_FALLBACK) { @@ -292,7 +292,7 @@ static size_t gensec_spnego_max_wrapped_size(struct gensec_security *gensec_secu static NTSTATUS gensec_spnego_session_key(struct gensec_security *gensec_security, DATA_BLOB *session_key) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (!spnego_state->sub_sec_security) { return NT_STATUS_INVALID_PARAMETER; } @@ -304,7 +304,7 @@ static NTSTATUS gensec_spnego_session_key(struct gensec_security *gensec_securit static NTSTATUS gensec_spnego_session_info(struct gensec_security *gensec_security, struct auth_session_info **session_info) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (!spnego_state->sub_sec_security) { return NT_STATUS_INVALID_PARAMETER; } @@ -685,7 +685,7 @@ static NTSTATUS gensec_spnego_server_negTokenTarg(struct gensec_security *gensec static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx, const DATA_BLOB in, DATA_BLOB *out) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; DATA_BLOB null_data_blob = data_blob(NULL, 0); DATA_BLOB unwrapped_out = data_blob(NULL, 0); struct spnego_data spnego_out; @@ -1002,7 +1002,7 @@ static NTSTATUS gensec_spnego_update(struct gensec_security *gensec_security, TA static BOOL gensec_spnego_have_feature(struct gensec_security *gensec_security, uint32_t feature) { - struct spnego_state *spnego_state = gensec_security->private_data; + struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; if (!spnego_state->sub_sec_security) { return False; } diff --git a/source4/auth/ntlmssp/ntlmssp.c b/source4/auth/ntlmssp/ntlmssp.c index a2d2d22170..77860c41c5 100644 --- a/source4/auth/ntlmssp/ntlmssp.c +++ b/source4/auth/ntlmssp/ntlmssp.c @@ -199,7 +199,7 @@ static NTSTATUS gensec_ntlmssp_update(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx, const DATA_BLOB input, DATA_BLOB *out) { - struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data; + struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; NTSTATUS status; uint32_t i; @@ -229,7 +229,7 @@ static NTSTATUS gensec_ntlmssp_update(struct gensec_security *gensec_security, NTSTATUS gensec_ntlmssp_session_key(struct gensec_security *gensec_security, DATA_BLOB *session_key) { - struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data; + struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; if (!gensec_ntlmssp_state->session_key.data) { return NT_STATUS_NO_USER_SESSION_KEY; @@ -344,7 +344,7 @@ DATA_BLOB ntlmssp_weakend_key(struct gensec_ntlmssp_state *gensec_ntlmssp_state, static BOOL gensec_ntlmssp_have_feature(struct gensec_security *gensec_security, uint32_t feature) { - struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data; + struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; if (feature & GENSEC_FEATURE_SIGN) { if (!gensec_ntlmssp_state->session_key.length) { return False; diff --git a/source4/auth/ntlmssp/ntlmssp_client.c b/source4/auth/ntlmssp/ntlmssp_client.c index 3f507908f2..003394a21b 100644 --- a/source4/auth/ntlmssp/ntlmssp_client.c +++ b/source4/auth/ntlmssp/ntlmssp_client.c @@ -47,7 +47,7 @@ NTSTATUS ntlmssp_client_initial(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx, DATA_BLOB in, DATA_BLOB *out) { - struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data; + struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; if (gensec_ntlmssp_state->unicode) { gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_UNICODE; @@ -87,7 +87,7 @@ NTSTATUS ntlmssp_client_challenge(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx, const DATA_BLOB in, DATA_BLOB *out) { - struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data; + struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; uint32_t chal_flags, ntlmssp_command, unkn1, unkn2; DATA_BLOB server_domain_blob; DATA_BLOB challenge_blob; @@ -292,7 +292,7 @@ NTSTATUS gensec_ntlmssp_client_start(struct gensec_security *gensec_security) nt_status = gensec_ntlmssp_start(gensec_security); NT_STATUS_NOT_OK_RETURN(nt_status); - gensec_ntlmssp_state = gensec_security->private_data; + gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; gensec_ntlmssp_state->role = NTLMSSP_CLIENT; diff --git a/source4/auth/ntlmssp/ntlmssp_server.c b/source4/auth/ntlmssp/ntlmssp_server.c index 18e38cf6bf..e29334e183 100644 --- a/source4/auth/ntlmssp/ntlmssp_server.c +++ b/source4/auth/ntlmssp/ntlmssp_server.c @@ -174,7 +174,7 @@ NTSTATUS ntlmssp_server_negotiate(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx, const DATA_BLOB in, DATA_BLOB *out) { - struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data; + struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; DATA_BLOB struct_blob; fstring dnsname, dnsdomname; uint32_t neg_flags = 0; @@ -447,7 +447,7 @@ static NTSTATUS ntlmssp_server_postauth(struct gensec_security *gensec_security, DATA_BLOB *user_session_key, DATA_BLOB *lm_session_key) { - struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data; + struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; NTSTATUS nt_status; DATA_BLOB session_key = data_blob(NULL, 0); @@ -594,7 +594,7 @@ NTSTATUS ntlmssp_server_auth(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx, const DATA_BLOB in, DATA_BLOB *out) { - struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data; + struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; DATA_BLOB user_session_key = data_blob(NULL, 0); DATA_BLOB lm_session_key = data_blob(NULL, 0); NTSTATUS nt_status; @@ -760,7 +760,7 @@ NTSTATUS gensec_ntlmssp_session_info(struct gensec_security *gensec_security, struct auth_session_info **session_info) { NTSTATUS nt_status; - struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data; + struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; nt_status = auth_generate_session_info(gensec_ntlmssp_state, gensec_ntlmssp_state->server_info, session_info); NT_STATUS_NOT_OK_RETURN(nt_status); @@ -784,7 +784,7 @@ NTSTATUS gensec_ntlmssp_server_start(struct gensec_security *gensec_security) nt_status = gensec_ntlmssp_start(gensec_security); NT_STATUS_NOT_OK_RETURN(nt_status); - gensec_ntlmssp_state = gensec_security->private_data; + gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; gensec_ntlmssp_state->role = NTLMSSP_SERVER; diff --git a/source4/auth/ntlmssp/ntlmssp_sign.c b/source4/auth/ntlmssp/ntlmssp_sign.c index 4eb6156deb..892960cf56 100644 --- a/source4/auth/ntlmssp/ntlmssp_sign.c +++ b/source4/auth/ntlmssp/ntlmssp_sign.c @@ -137,7 +137,7 @@ _PUBLIC_ NTSTATUS gensec_ntlmssp_sign_packet(struct gensec_security *gensec_secu const uint8_t *whole_pdu, size_t pdu_length, DATA_BLOB *sig) { - struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data; + struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; return ntlmssp_make_packet_signature(gensec_ntlmssp_state, sig_mem_ctx, data, length, @@ -156,7 +156,7 @@ NTSTATUS gensec_ntlmssp_check_packet(struct gensec_security *gensec_security, const uint8_t *whole_pdu, size_t pdu_length, const DATA_BLOB *sig) { - struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data; + struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; DATA_BLOB local_sig; NTSTATUS nt_status; @@ -220,7 +220,7 @@ NTSTATUS gensec_ntlmssp_seal_packet(struct gensec_security *gensec_security, const uint8_t *whole_pdu, size_t pdu_length, DATA_BLOB *sig) { - struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data; + struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; NTSTATUS nt_status; if (!gensec_ntlmssp_state->session_key.length) { DEBUG(3, ("NO session key, cannot seal packet\n")); @@ -281,7 +281,7 @@ NTSTATUS gensec_ntlmssp_unseal_packet(struct gensec_security *gensec_security, const uint8_t *whole_pdu, size_t pdu_length, const DATA_BLOB *sig) { - struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data; + struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data; if (!gensec_ntlmssp_state->session_key.length) { DEBUG(3, ("NO session key, cannot unseal packet\n")); return NT_STATUS_NO_USER_SESSION_KEY; diff --git a/source4/cluster/ctdb/client/ctdb_client.c b/source4/cluster/ctdb/client/ctdb_client.c index b569a69c8d..626ecf01c7 100644 --- a/source4/cluster/ctdb/client/ctdb_client.c +++ b/source4/cluster/ctdb/client/ctdb_client.c @@ -1970,7 +1970,7 @@ int ctdb_ctrl_set_tunable(struct ctdb_context *ctdb, int ret; data.dsize = offsetof(struct ctdb_control_set_tunable, name) + strlen(name) + 1; - data.dptr = talloc_size(ctdb, data.dsize); + data.dptr = talloc_array(ctdb, unsigned char, data.dsize); CTDB_NO_MEMORY(ctdb, data.dptr); t = (struct ctdb_control_set_tunable *)data.dptr; diff --git a/source4/cluster/ctdb/common/ctdb_io.c b/source4/cluster/ctdb/common/ctdb_io.c index 3cc522b58a..5c418e4956 100644 --- a/source4/cluster/ctdb/common/ctdb_io.c +++ b/source4/cluster/ctdb/common/ctdb_io.c @@ -73,8 +73,9 @@ static void queue_io_read(struct ctdb_queue *queue) } - queue->partial.data = talloc_realloc_size(queue, queue->partial.data, - num_ready + queue->partial.length); + queue->partial.data = talloc_realloc(queue, queue->partial.data, + uint8_t, + num_ready + queue->partial.length); if (queue->partial.data == NULL) { DEBUG(0,("read error alloc failed for %u\n", diff --git a/source4/cluster/ctdb/common/ctdb_util.c b/source4/cluster/ctdb/common/ctdb_util.c index 54b1e4e7ff..f11388331d 100644 --- a/source4/cluster/ctdb/common/ctdb_util.c +++ b/source4/cluster/ctdb/common/ctdb_util.c @@ -51,7 +51,7 @@ void ctdb_set_error(struct ctdb_context *ctdb, const char *fmt, ...) /* a fatal internal error occurred - no hope for recovery */ -void ctdb_fatal(struct ctdb_context *ctdb, const char *msg) +_NORETURN_ void ctdb_fatal(struct ctdb_context *ctdb, const char *msg) { DEBUG(0,("ctdb fatal error: %s\n", msg)); abort(); diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 8acb794251..d416a63374 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -52,7 +52,7 @@ struct cluster_state { */ static struct server_id ctdb_id(struct cluster_ops *ops, uint32_t id) { - struct cluster_state *state = ops->private; + struct cluster_state *state = (struct cluster_state *)ops->private; struct ctdb_context *ctdb = state->ctdb; struct server_id server_id; server_id.node = ctdb_get_vnn(ctdb); @@ -100,7 +100,7 @@ static struct tdb_wrap *ctdb_tdb_tmp_open(struct cluster_ops *ops, */ static void *ctdb_backend_handle(struct cluster_ops *ops) { - struct cluster_state *state = ops->private; + struct cluster_state *state = (struct cluster_state *)ops->private; return (void *)state->ctdb; } @@ -138,7 +138,7 @@ static NTSTATUS ctdb_message_init(struct cluster_ops *ops, struct server_id server, cluster_message_fn_t handler) { - struct cluster_state *state = ops->private; + struct cluster_state *state = (struct cluster_state *)ops->private; struct ctdb_handler_state *h; int ret; @@ -169,7 +169,7 @@ static NTSTATUS ctdb_message_init(struct cluster_ops *ops, static NTSTATUS ctdb_message_send(struct cluster_ops *ops, struct server_id server, DATA_BLOB *data) { - struct cluster_state *state = ops->private; + struct cluster_state *state = (struct cluster_state *)ops->private; struct ctdb_context *ctdb = state->ctdb; TDB_DATA tdata; int ret; diff --git a/source4/dsdb/samdb/ldb_modules/entryUUID.c b/source4/dsdb/samdb/ldb_modules/entryUUID.c index f5de138b52..1a16cb8321 100644 --- a/source4/dsdb/samdb/ldb_modules/entryUUID.c +++ b/source4/dsdb/samdb/ldb_modules/entryUUID.c @@ -693,7 +693,7 @@ static int nsuniqueid_init(struct ldb_module *module) static int get_seq(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { - unsigned long long *max_seq = context; + unsigned long long *max_seq = (unsigned long long *)context; unsigned long long seq; if (ares->type == LDB_REPLY_ENTRY) { struct ldb_message_element *el = ldb_msg_find_element(ares->message, "contextCSN"); diff --git a/source4/dsdb/samdb/ldb_modules/kludge_acl.c b/source4/dsdb/samdb/ldb_modules/kludge_acl.c index 2d6d8a2d80..27c13ddf60 100644 --- a/source4/dsdb/samdb/ldb_modules/kludge_acl.c +++ b/source4/dsdb/samdb/ldb_modules/kludge_acl.c @@ -60,7 +60,7 @@ struct kludge_private_data { static enum user_is what_is_user(struct ldb_module *module) { struct auth_session_info *session_info - = ldb_get_opaque(module->ldb, "sessionInfo"); + = (struct auth_session_info *)ldb_get_opaque(module->ldb, "sessionInfo"); if (!session_info) { return ANONYMOUS; } @@ -87,7 +87,7 @@ static enum user_is what_is_user(struct ldb_module *module) static const char *user_name(TALLOC_CTX *mem_ctx, struct ldb_module *module) { struct auth_session_info *session_info - = ldb_get_opaque(module->ldb, "sessionInfo"); + = (struct auth_session_info *)ldb_get_opaque(module->ldb, "sessionInfo"); if (!session_info) { return "UNKNOWN (NULL)"; } diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c index 0675f38c56..76e8578573 100644 --- a/source4/dsdb/samdb/ldb_modules/partition.c +++ b/source4/dsdb/samdb/ldb_modules/partition.c @@ -678,8 +678,10 @@ static int partition_extended(struct ldb_module *module, struct ldb_request *req static int sort_compare(void *void1, void *void2, void *opaque) { - struct dsdb_control_current_partition **pp1 = void1; - struct dsdb_control_current_partition **pp2 = void2; + struct dsdb_control_current_partition **pp1 = + (struct dsdb_control_current_partition **)void1; + struct dsdb_control_current_partition **pp2 = + (struct dsdb_control_current_partition **)void2; struct dsdb_control_current_partition *partition1 = talloc_get_type(*pp1, struct dsdb_control_current_partition); struct dsdb_control_current_partition *partition2 = talloc_get_type(*pp2, @@ -692,7 +694,8 @@ static const char *relative_path(struct ldb_module *module, TALLOC_CTX *mem_ctx, const char *name) { - const char *base_url = ldb_get_opaque(module->ldb, "ldb_url"); + const char *base_url = + (const char *)ldb_get_opaque(module->ldb, "ldb_url"); char *path, *p, *full_name; if (name == NULL) { return NULL; diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index fdc78e3cad..31182a44d6 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -1070,7 +1070,7 @@ const struct dom_sid *samdb_domain_sid(struct ldb_context *ldb) struct dom_sid *domain_sid; /* see if we have a cached copy */ - domain_sid = ldb_get_opaque(ldb, "cache.domain_sid"); + domain_sid = (struct dom_sid *)ldb_get_opaque(ldb, "cache.domain_sid"); if (domain_sid) { return domain_sid; } @@ -1137,7 +1137,7 @@ struct ldb_dn *samdb_ntds_settings_dn(struct ldb_context *ldb) struct ldb_dn *settings_dn; /* see if we have a cached copy */ - settings_dn = ldb_get_opaque(ldb, "cache.settings_dn"); + settings_dn = (struct ldb_dn *)ldb_get_opaque(ldb, "cache.settings_dn"); if (settings_dn) { return settings_dn; } @@ -1190,7 +1190,7 @@ const struct GUID *samdb_ntds_invocation_id(struct ldb_context *ldb) struct GUID *invocation_id; /* see if we have a cached copy */ - invocation_id = ldb_get_opaque(ldb, "cache.invocation_id"); + invocation_id = (struct GUID *)ldb_get_opaque(ldb, "cache.invocation_id"); if (invocation_id) { return invocation_id; } @@ -1240,7 +1240,8 @@ bool samdb_set_ntds_invocation_id(struct ldb_context *ldb, const struct GUID *in struct GUID *invocation_id_old; /* see if we have a cached copy */ - invocation_id_old = ldb_get_opaque(ldb, "cache.invocation_id"); + invocation_id_old = (struct GUID *)ldb_get_opaque(ldb, + "cache.invocation_id"); tmp_ctx = talloc_new(ldb); if (tmp_ctx == NULL) { @@ -1283,7 +1284,7 @@ const struct GUID *samdb_ntds_objectGUID(struct ldb_context *ldb) struct GUID *ntds_guid; /* see if we have a cached copy */ - ntds_guid = ldb_get_opaque(ldb, "cache.ntds_guid"); + ntds_guid = (struct GUID *)ldb_get_opaque(ldb, "cache.ntds_guid"); if (ntds_guid) { return ntds_guid; } @@ -1333,7 +1334,7 @@ bool samdb_set_ntds_objectGUID(struct ldb_context *ldb, const struct GUID *ntds_ struct GUID *ntds_guid_old; /* see if we have a cached copy */ - ntds_guid_old = ldb_get_opaque(ldb, "cache.ntds_guid"); + ntds_guid_old = (struct GUID *)ldb_get_opaque(ldb, "cache.ntds_guid"); tmp_ctx = talloc_new(ldb); if (tmp_ctx == NULL) { diff --git a/source4/dsdb/schema/schema_constructed.c b/source4/dsdb/schema/schema_constructed.c index 3ded84c184..51343817b0 100644 --- a/source4/dsdb/schema/schema_constructed.c +++ b/source4/dsdb/schema/schema_constructed.c @@ -38,10 +38,6 @@ static char *dsdb_subSchema_list_append(char *v, const char *list_name) NULL }; - if (!attrs) { - return v; - } - v = talloc_asprintf_append(v, "%s ( ", list_name); if (!v) return NULL; diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c index dc717daa65..7c26675713 100644 --- a/source4/kdc/kpasswdd.c +++ b/source4/kdc/kpasswdd.c @@ -267,7 +267,8 @@ static BOOL kpasswd_process_request(struct kdc_server *kdc, reply); } - password = talloc_strndup(mem_ctx, chpw.newpasswd.data, + password = talloc_strndup(mem_ctx, + (const char *)chpw.newpasswd.data, chpw.newpasswd.length); if (!password) { free_ChangePasswdDataMS(&chpw); diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c index 6bbf31dee7..a7f72dd6d0 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_cache.c +++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c @@ -58,7 +58,7 @@ static const struct { */ static void ltdb_attributes_unload(struct ldb_module *module) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; struct ldb_message *msg; int i; @@ -105,7 +105,7 @@ static int ltdb_attributes_flags(struct ldb_message_element *el, unsigned *v) */ static int ltdb_attributes_load(struct ldb_module *module) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; struct ldb_message *msg = ltdb->cache->attributes; struct ldb_dn *dn; int i, r; @@ -172,7 +172,7 @@ failed: */ static int ltdb_subclasses_load(struct ldb_module *module) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; struct ldb_message *msg = ltdb->cache->subclasses; struct ldb_dn *dn; int i, j, r; @@ -208,7 +208,7 @@ failed: */ static void ltdb_subclasses_unload(struct ldb_module *module) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; struct ldb_message *msg; int i; @@ -232,7 +232,7 @@ static void ltdb_subclasses_unload(struct ldb_module *module) */ static int ltdb_baseinfo_init(struct ldb_module *module) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; struct ldb_message *msg; struct ldb_message_element el; struct ldb_val val; @@ -285,7 +285,7 @@ failed: */ static void ltdb_cache_free(struct ldb_module *module) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; ltdb->sequence_number = 0; talloc_free(ltdb->cache); @@ -308,7 +308,7 @@ int ltdb_cache_reload(struct ldb_module *module) */ int ltdb_cache_load(struct ldb_module *module) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; struct ldb_dn *baseinfo_dn = NULL; struct ldb_dn *indexlist_dn = NULL; uint64_t seq; @@ -417,7 +417,7 @@ failed: */ int ltdb_increase_sequence_number(struct ldb_module *module) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; struct ldb_message *msg; struct ldb_message_element el[2]; struct ldb_val val; diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c index 1fe697f277..bcab3acafe 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_index.c +++ b/source4/lib/ldb/ldb_tdb/ldb_index.c @@ -45,7 +45,7 @@ static int ldb_list_find(const void *needle, const void *base, size_t nmemb, size_t size, comparison_fn_t comp_fn) { - const char *base_p = base; + const char *base_p = (const char *)base; size_t min_i, max_i, test_i; if (nmemb == 0) { @@ -1014,7 +1014,7 @@ static int ltdb_index_add1(struct ldb_module *module, const char *dn, static int ltdb_index_add0(struct ldb_module *module, const char *dn, struct ldb_message_element *elements, int num_el) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; int ret; unsigned int i, j; @@ -1138,7 +1138,7 @@ int ltdb_index_del_value(struct ldb_module *module, const char *dn, */ int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; int ret; const char *dn; unsigned int i, j; @@ -1180,7 +1180,7 @@ int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg) */ int ltdb_index_one(struct ldb_module *module, const struct ldb_message *msg, int add) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; struct ldb_message_element el; struct ldb_val val; struct ldb_dn *pdn; @@ -1244,7 +1244,7 @@ static int delete_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, vo */ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *state) { - struct ldb_module *module = state; + struct ldb_module *module = (struct ldb_module *)state; struct ldb_message *msg; const char *dn = NULL; int ret; @@ -1309,7 +1309,7 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void * */ int ltdb_reindex(struct ldb_module *module) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; int ret; if (ltdb_cache_reload(module) != 0) { diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c index 013b341d42..a195a39391 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_search.c +++ b/source4/lib/ldb/ldb_tdb/ldb_search.c @@ -210,7 +210,7 @@ static struct ldb_message *ltdb_pull_attrs(struct ldb_module *module, */ int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_message *msg) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; int ret; TDB_DATA tdb_key, tdb_data; @@ -252,7 +252,7 @@ int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_mes */ static int ltdb_lock_read(struct ldb_module *module) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; return tdb_lockall_read(ltdb->tdb); } @@ -261,7 +261,7 @@ static int ltdb_lock_read(struct ldb_module *module) */ static int ltdb_unlock_read(struct ldb_module *module) { - struct ltdb_private *ltdb = module->private_data; + struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; return tdb_unlockall_read(ltdb->tdb); } diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index c4c0d0e059..4b609b09e9 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -504,7 +504,7 @@ NTSTATUS messaging_send_ptr(struct messaging_context *msg, struct server_id serv { DATA_BLOB blob; - blob.data = (void *)&ptr; + blob.data = (uint8_t *)&ptr; blob.length = sizeof(void *); return messaging_send(msg, server, msg_type, &blob); diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c index 8ccb96cbdc..035d556abf 100644 --- a/source4/lib/registry/local.c +++ b/source4/lib/registry/local.c @@ -139,9 +139,8 @@ WERROR local_get_predefined_key (const struct registry_context *ctx, return WERR_NOT_FOUND; *key = reg_import_hive_key(ctx, mp->key, - mp->path.predefined_key, - mp->path.elements - ); + mp->path.predefined_key, + mp->path.elements); return WERR_OK; } diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c index 993de19f98..ccabf4ca07 100644 --- a/source4/lib/registry/patchfile_preg.c +++ b/source4/lib/registry/patchfile_preg.c @@ -21,6 +21,7 @@ #include "includes.h" #include "lib/registry/registry.h" +#include "lib/registry/patchfile.h" #include "system/filesys.h" #include "pstring.h" diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index d74ffd2b4b..0c40773daa 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -1664,7 +1664,7 @@ static WERROR regf_set_value(struct hive_key *key, const char *name, DATA_BLOB value_list; value_list.length = (nk->num_values+1)*4; - value_list.data = (void *)talloc_array(private_data, uint32_t, nk->num_values+1); + value_list.data = talloc_array(private_data, uint32_t, nk->num_values+1); W_ERROR_HAVE_NO_MEMORY(value_list.data); memcpy(value_list.data, values.data, nk->num_values * 4); diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 131d76fff5..cdf688b39e 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -262,8 +262,7 @@ static WERROR cmd_rmval(struct regshell_context *ctx, int argc, char **argv) return WERR_OK; } -static WERROR cmd_exit(struct regshell_context *ctx, - int argc, char **argv) +_NORETURN_ static WERROR cmd_exit(struct regshell_context *ctx, int argc, char **argv) { exit(0); return WERR_OK; @@ -275,8 +274,7 @@ static struct { const char *name; const char *alias; const char *help; - WERROR (*handle)(struct regshell_context *ctx, - int argc, char **argv); + WERROR (*handle)(struct regshell_context *ctx, int argc, char **argv); } regshell_cmds[] = { {"ck", "cd", "Change current key", cmd_ck }, {"info", "i", "Show detailed information of a key", cmd_info }, diff --git a/source4/lib/util/fault.c b/source4/lib/util/fault.c index 5cc9445407..e9cd040ee6 100644 --- a/source4/lib/util/fault.c +++ b/source4/lib/util/fault.c @@ -153,7 +153,7 @@ _PUBLIC_ _NORETURN_ void smb_panic(const char *why) /** report a fault **/ -static void fault_report(int sig) +_NORETURN_ static void fault_report(int sig) { static int counter; @@ -172,7 +172,7 @@ static void fault_report(int sig) /** catch serious errors **/ -static void sig_fault(int sig) +_NORETURN_ static void sig_fault(int sig) { if (fault_handlers.fault_handler) { /* we have a fault handler, call it. It may not return. */ diff --git a/source4/lib/util/time.c b/source4/lib/util/time.c index 4601833a3d..fc51498009 100644 --- a/source4/lib/util/time.c +++ b/source4/lib/util/time.c @@ -269,7 +269,7 @@ _PUBLIC_ time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset) x2 = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16); SIVAL(&x,0,x2); - return pull_dos_date((void *)&x, zone_offset); + return pull_dos_date((const uint8_t *)&x, zone_offset); } /** diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c index 64f6f90d31..06ff000acf 100644 --- a/source4/libcli/ldap/ldap.c +++ b/source4/libcli/ldap/ldap.c @@ -497,7 +497,7 @@ BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ct static const char *blob2string_talloc(TALLOC_CTX *mem_ctx, DATA_BLOB blob) { - char *result = talloc_size(mem_ctx, blob.length+1); + char *result = talloc_array(mem_ctx, char, blob.length+1); memcpy(result, blob.data, blob.length); result[blob.length] = '\0'; return result; @@ -955,7 +955,7 @@ NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg) return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR); } if (pwlen != 0) { - char *pw = talloc_size(msg, pwlen+1); + char *pw = talloc_array(msg, char, pwlen+1); if (!pw) { return NT_STATUS_LDAP(LDAP_OPERATIONS_ERROR); } @@ -1162,7 +1162,7 @@ NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg) if (len == -1) { return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR); } - dn = talloc_size(msg, len+1); + dn = talloc_array(msg, char, len+1); if (dn == NULL) break; asn1_read(data, dn, len); @@ -1198,7 +1198,7 @@ NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg) if (len == -1) { return NT_STATUS_LDAP(LDAP_PROTOCOL_ERROR); } - newsup = talloc_size(msg, len+1); + newsup = talloc_array(msg, char, len+1); if (newsup == NULL) { return NT_STATUS_LDAP(LDAP_OPERATIONS_ERROR); } diff --git a/source4/libcli/nbt/nbtsocket.c b/source4/libcli/nbt/nbtsocket.c index 597dc5a354..bb3e15d5de 100644 --- a/source4/libcli/nbt/nbtsocket.c +++ b/source4/libcli/nbt/nbtsocket.c @@ -214,7 +214,8 @@ static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock) } /* find the matching request */ - req = idr_find(nbtsock->idr, packet->name_trn_id); + req = (struct nbt_name_request *)idr_find(nbtsock->idr, + packet->name_trn_id); if (req == NULL) { if (nbtsock->unexpected.handler) { nbtsock->unexpected.handler(nbtsock, packet, src); diff --git a/source4/libcli/resolve/resolve.c b/source4/libcli/resolve/resolve.c index 4df4de020c..63598fdd00 100644 --- a/source4/libcli/resolve/resolve.c +++ b/source4/libcli/resolve/resolve.c @@ -67,7 +67,7 @@ static const struct resolve_method *find_method(const char *name) */ static void resolve_handler(struct composite_context *creq) { - struct composite_context *c = creq->async.private_data; + struct composite_context *c = (struct composite_context *)creq->async.private_data; struct resolve_state *state = talloc_get_type(c->private_data, struct resolve_state); const struct resolve_method *method = find_method(state->methods[0]); diff --git a/source4/libcli/security/dom_sid.c b/source4/libcli/security/dom_sid.c index 64e418677a..8d6bb79714 100644 --- a/source4/libcli/security/dom_sid.c +++ b/source4/libcli/security/dom_sid.c @@ -278,7 +278,7 @@ char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid) } maxlen = sid->num_auths * 11 + 25; - ret = talloc_size(mem_ctx, maxlen); + ret = talloc_array(mem_ctx, char, maxlen); if (!ret) return talloc_strdup(mem_ctx, "(SID ERR)"); ia = (sid->id_auth[5]) + diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c index 392fec1cb9..545f3c8353 100644 --- a/source4/libcli/smb2/request.c +++ b/source4/libcli/smb2/request.c @@ -67,7 +67,7 @@ struct smb2_request *smb2_request_init(struct smb2_transport *transport, uint16_ req->out.size = SMB2_HDR_BODY+NBT_HDR_SIZE+body_fixed_size; req->out.allocated = req->out.size + body_dynamic_size; - req->out.buffer = talloc_size(req, req->out.allocated); + req->out.buffer = talloc_array(req, uint8_t, req->out.allocated); if (req->out.buffer == NULL) { talloc_free(req); return NULL; diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c index e7a2e163aa..8bd091a319 100644 --- a/source4/libcli/util/asn1.c +++ b/source4/libcli/util/asn1.c @@ -600,7 +600,7 @@ BOOL asn1_read_LDAPString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s) data->has_error = True; return False; } - *s = talloc_size(mem_ctx, len+1); + *s = talloc_array(mem_ctx, char, len+1); if (! *s) { data->has_error = True; return False; diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h index 09a2680190..522031b8e4 100644 --- a/source4/librpc/ndr/libndr.h +++ b/source4/librpc/ndr/libndr.h @@ -269,7 +269,7 @@ enum ndr_compression_alg { #define NDR_PUSH_ALLOC_SIZE(ndr, s, size) do { \ - (s) = talloc_size(ndr, size); \ + (s) = talloc_array(ndr, uint8_t, size); \ if (!(s)) return ndr_push_error(ndr, NDR_ERR_ALLOC, "push alloc %u failed: %s\n", (unsigned)size, __location__); \ } while (0) diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 9fb39beff3..a9e42f1eb6 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -200,13 +200,16 @@ _PUBLIC_ void ndr_print_string_helper(struct ndr_print *ndr, const char *format, int i; for (i=0;i<ndr->depth;i++) { - ndr->private_data = talloc_asprintf_append(ndr->private_data, " "); + ndr->private_data = talloc_asprintf_append( + (char *)ndr->private_data, " "); } va_start(ap, format); - ndr->private_data = talloc_vasprintf_append(ndr->private_data, format, ap); + ndr->private_data = talloc_vasprintf_append((char *)ndr->private_data, + format, ap); va_end(ap); - ndr->private_data = talloc_asprintf_append(ndr->private_data, "\n"); + ndr->private_data = talloc_asprintf_append((char *)ndr->private_data, + "\n"); } /* @@ -276,7 +279,7 @@ _PUBLIC_ char *ndr_print_struct_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, c ndr->depth = 1; ndr->flags = 0; fn(ndr, name, ptr); - ret = talloc_steal(mem_ctx, ndr->private_data); + ret = talloc_steal(mem_ctx, (char *)ndr->private_data); failed: talloc_free(ndr); return ret; @@ -301,7 +304,7 @@ _PUBLIC_ char *ndr_print_union_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, co ndr->flags = 0; ndr_print_set_switch_value(ndr, ptr, level); fn(ndr, name, ptr); - ret = talloc_steal(mem_ctx, ndr->private_data); + ret = talloc_steal(mem_ctx, (char *)ndr->private_data); failed: talloc_free(ndr); return ret; @@ -327,7 +330,7 @@ _PUBLIC_ char *ndr_print_function_string(TALLOC_CTX *mem_ctx, ndr->depth = 1; ndr->flags = 0; fn(ndr, name, flags, ptr); - ret = talloc_steal(mem_ctx, ndr->private_data); + ret = talloc_steal(mem_ctx, (char *)ndr->private_data); failed: talloc_free(ndr); return ret; diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c index fca864a5eb..b611f87a41 100644 --- a/source4/librpc/ndr/ndr_string.c +++ b/source4/librpc/ndr/ndr_string.c @@ -640,7 +640,7 @@ _PUBLIC_ uint32_t ndr_string_length(const void *_var, uint32_t element_size) { uint32_t i; uint8_t zero[4] = {0,0,0,0}; - const char *var = _var; + const char *var = (const char *)_var; for (i = 0; memcmp(var+i*element_size,zero,element_size) != 0; i++); @@ -731,5 +731,5 @@ _PUBLIC_ uint32_t ndr_charset_length(const void *var, charset_t chset) { /* FIXME: Treat special chars special here, taking chset into account */ /* Also include 0 byte */ - return strlen(var)+1; + return strlen((const char *)var)+1; } diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index 160b9772f4..56e603645c 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -959,7 +959,7 @@ static struct rpc_request *dcerpc_request_send(struct dcerpc_pipe *p, req->recv_handler = NULL; if (object != NULL) { - req->object = talloc_memdup(req, (void *)object, sizeof(*object)); + req->object = (struct GUID *)talloc_memdup(req, (void *)object, sizeof(*object)); if (req->object == NULL) { talloc_free(req); return NULL; diff --git a/source4/librpc/rpc/dcerpc_sock.c b/source4/librpc/rpc/dcerpc_sock.c index 974cbd2692..a28b21b5c3 100644 --- a/source4/librpc/rpc/dcerpc_sock.c +++ b/source4/librpc/rpc/dcerpc_sock.c @@ -193,7 +193,7 @@ static NTSTATUS sock_send_request(struct dcerpc_connection *p, DATA_BLOB *data, */ static NTSTATUS sock_shutdown_pipe(struct dcerpc_connection *p, NTSTATUS status) { - struct sock_private *sock = p->transport.private_data; + struct sock_private *sock = (struct sock_private *)p->transport.private_data; if (sock && sock->sock) { sock_dead(p, status); diff --git a/source4/scripting/ejs/smbcalls_cli.c b/source4/scripting/ejs/smbcalls_cli.c index e94207bf36..fc26fddfd5 100644 --- a/source4/scripting/ejs/smbcalls_cli.c +++ b/source4/scripting/ejs/smbcalls_cli.c @@ -483,7 +483,7 @@ static int ejs_tree_disconnect(MprVarHandle eid, int argc, MprVar **argv) return -1; } - tree = talloc_check_name(argv[0]->ptr, "struct smbcli_tree"); + tree = talloc_get_type(argv[0]->ptr, struct smbcli_tree); result = smb_tree_disconnect(tree); @@ -512,7 +512,7 @@ static int ejs_mkdir(MprVarHandle eid, int argc, MprVar **argv) return -1; } - tree = argv[0]->ptr; + tree = (struct smbcli_tree *)argv[0]->ptr; if (!mprVarIsString(argv[1]->type)) { ejsSetErrorMsg(eid, "arg 2 must be a string"); @@ -546,7 +546,7 @@ static int ejs_rmdir(MprVarHandle eid, int argc, MprVar **argv) return -1; } - tree = argv[0]->ptr; + tree = (struct smbcli_tree *)argv[0]->ptr; if (!mprVarIsString(argv[1]->type)) { ejsSetErrorMsg(eid, "arg 2 must be a string"); @@ -580,7 +580,7 @@ static int ejs_rename(MprVarHandle eid, int argc, MprVar **argv) return -1; } - tree = argv[0]->ptr; + tree = (struct smbcli_tree *)argv[0]->ptr; if (!mprVarIsString(argv[1]->type)) { ejsSetErrorMsg(eid, "arg 2 must be a string"); @@ -619,7 +619,7 @@ static int ejs_unlink(MprVarHandle eid, int argc, MprVar **argv) return -1; } - tree = argv[0]->ptr; + tree = (struct smbcli_tree *)argv[0]->ptr; if (!mprVarIsString(argv[1]->type)) { ejsSetErrorMsg(eid, "arg 2 must be a string"); @@ -666,7 +666,7 @@ static int ejs_list(MprVarHandle eid, int argc, MprVar **argv) return -1; } - tree = argv[0]->ptr; + tree = (struct smbcli_tree *)argv[0]->ptr; if (!mprVarIsString(argv[1]->type)) { ejsSetErrorMsg(eid, "arg 2 must be a string"); diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c index 4addd473da..b95681d4ef 100644 --- a/source4/scripting/ejs/smbcalls_rpc.c +++ b/source4/scripting/ejs/smbcalls_rpc.c @@ -144,7 +144,8 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, char **argv) credentials = mprGetProperty(this, "credentials", NULL); if (credentials) { - creds = mprGetPtr(credentials, "creds"); + creds = (struct cli_credentials *) + mprGetPtr(credentials, "creds"); } else { creds = cmdline_credentials; } @@ -188,7 +189,7 @@ static int ejs_irpc_call(int eid, struct MprVar *io, int i, count; struct MprVar *results; - p = mprGetThisPtr(eid, "irpc"); + p = (struct ejs_irpc_connection *)mprGetThisPtr(eid, "irpc"); ejs = talloc(mprMemCtx(), struct ejs_rpc); if (ejs == NULL) { diff --git a/source4/torture/basic/aliases.c b/source4/torture/basic/aliases.c index 0b5f1fb88a..660009704b 100644 --- a/source4/torture/basic/aliases.c +++ b/source4/torture/basic/aliases.c @@ -381,9 +381,9 @@ static bool setpathinfo_aliases(struct torture_context *tctx, /* look for aliased info levels in trans2 calls */ -struct torture_suite *torture_trans2_aliases(void) +struct torture_suite *torture_trans2_aliases(TALLOC_CTX *mem_ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "ALIASES"); + struct torture_suite *suite = torture_suite_create(mem_ctx, "ALIASES"); torture_suite_add_1smb_test(suite, "QFILEINFO aliases", qfsinfo_aliases); torture_suite_add_1smb_test(suite, "QFSINFO aliases", qfileinfo_aliases); diff --git a/source4/torture/basic/attr.c b/source4/torture/basic/attr.c index 4c6a7a3ab6..07071bb68a 100644 --- a/source4/torture/basic/attr.c +++ b/source4/torture/basic/attr.c @@ -86,8 +86,8 @@ static const struct trunc_open_results attr_results[] = { }; -BOOL torture_openattrtest(struct torture_context *tctx, - struct smbcli_state *cli1) +bool torture_openattrtest(struct torture_context *tctx, + struct smbcli_state *cli1) { const char *fname = "\\openattr.file"; int fnum1; diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index 2cb0c6a985..8c510efab4 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -1715,7 +1715,7 @@ NTSTATUS torture_base_init(void) struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "BASE"); torture_suite_add_2smb_test(suite, "FDPASS", run_fdpasstest); - torture_suite_add_suite(suite, torture_base_locktest()); + torture_suite_add_suite(suite, torture_base_locktest(suite)); torture_suite_add_1smb_test(suite, "UNLINK", torture_unlinktest); torture_suite_add_1smb_test(suite, "ATTR", run_attrtest); torture_suite_add_1smb_test(suite, "TRANS2", run_trans2test); @@ -1750,7 +1750,7 @@ NTSTATUS torture_base_init(void) torture_suite_add_1smb_test(suite, "CASETABLE", torture_casetable); torture_suite_add_1smb_test(suite, "UTABLE", torture_utable); torture_suite_add_simple_test(suite, "SMB", torture_smb_scan); - torture_suite_add_suite(suite, torture_trans2_aliases()); + torture_suite_add_suite(suite, torture_trans2_aliases(suite)); torture_suite_add_1smb_test(suite, "TRANS2-SCAN", torture_trans2_scan); torture_suite_add_1smb_test(suite, "NTTRANS", torture_nttrans_scan); diff --git a/source4/torture/basic/denytest.c b/source4/torture/basic/denytest.c index 98f4323ce6..05c613d647 100644 --- a/source4/torture/basic/denytest.c +++ b/source4/torture/basic/denytest.c @@ -1410,8 +1410,8 @@ static void progress_bar(struct torture_context *tctx, uint_t i, uint_t total) /* this produces a matrix of deny mode behaviour for 1 connection */ -BOOL torture_denytest1(struct torture_context *tctx, - struct smbcli_state *cli1) +bool torture_denytest1(struct torture_context *tctx, + struct smbcli_state *cli1) { int fnum1, fnum2; int i; @@ -1500,9 +1500,9 @@ failed: /* this produces a matrix of deny mode behaviour with 2 connections */ -BOOL torture_denytest2(struct torture_context *tctx, - struct smbcli_state *cli1, - struct smbcli_state *cli2) +bool torture_denytest2(struct torture_context *tctx, + struct smbcli_state *cli1, + struct smbcli_state *cli2) { int fnum1, fnum2; int i; @@ -1588,9 +1588,9 @@ failed: /* simple test harness for playing with deny modes */ -BOOL torture_denytest3(struct torture_context *tctx, - struct smbcli_state *cli1, - struct smbcli_state *cli2) +bool torture_denytest3(struct torture_context *tctx, + struct smbcli_state *cli1, + struct smbcli_state *cli2) { int fnum1, fnum2; const char *fname; @@ -1889,7 +1889,8 @@ failed: /* a denytest for ntcreatex */ -BOOL torture_ntdenytest1(struct torture_context *tctx, struct smbcli_state *cli, int client) +bool torture_ntdenytest1(struct torture_context *tctx, + struct smbcli_state *cli, int client) { extern int torture_seed; @@ -1903,9 +1904,9 @@ BOOL torture_ntdenytest1(struct torture_context *tctx, struct smbcli_state *cli, /* a denytest for ntcreatex */ -BOOL torture_ntdenytest2(struct torture_context *torture, - struct smbcli_state *cli1, - struct smbcli_state *cli2) +bool torture_ntdenytest2(struct torture_context *torture, + struct smbcli_state *cli1, + struct smbcli_state *cli2) { return torture_ntdenytest(torture, cli1, cli2, 0); } @@ -1929,8 +1930,8 @@ BOOL torture_ntdenytest2(struct torture_context *torture, /* test sharing of handles with DENY_DOS on a single connection */ -BOOL torture_denydos_sharing(struct torture_context *tctx, - struct smbcli_state *cli) +bool torture_denydos_sharing(struct torture_context *tctx, + struct smbcli_state *cli) { union smb_open io; union smb_fileinfo finfo; diff --git a/source4/torture/basic/dir.c b/source4/torture/basic/dir.c index 8b37188299..9f9122fe32 100644 --- a/source4/torture/basic/dir.c +++ b/source4/torture/basic/dir.c @@ -33,8 +33,8 @@ static void list_fn(struct clilist_file_info *finfo, const char *name, void *sta /* test directory listing speed */ -BOOL torture_dirtest1(struct torture_context *tctx, - struct smbcli_state *cli) +bool torture_dirtest1(struct torture_context *tctx, + struct smbcli_state *cli) { int i; int fnum; @@ -76,8 +76,8 @@ BOOL torture_dirtest1(struct torture_context *tctx, return correct; } -BOOL torture_dirtest2(struct torture_context *tctx, - struct smbcli_state *cli) +bool torture_dirtest2(struct torture_context *tctx, + struct smbcli_state *cli) { int i; int fnum, num_seen; diff --git a/source4/torture/basic/disconnect.c b/source4/torture/basic/disconnect.c index e05e3ef082..1dab4b0cae 100644 --- a/source4/torture/basic/disconnect.c +++ b/source4/torture/basic/disconnect.c @@ -126,7 +126,7 @@ static BOOL test_disconnect_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) /* basic testing of disconnects */ -BOOL torture_disconnect(struct torture_context *torture) +bool torture_disconnect(struct torture_context *torture) { BOOL ret = True; TALLOC_CTX *mem_ctx; diff --git a/source4/torture/basic/locking.c b/source4/torture/basic/locking.c index aa3168fb08..0d66ecf30b 100644 --- a/source4/torture/basic/locking.c +++ b/source4/torture/basic/locking.c @@ -795,10 +795,9 @@ fail: return correct; } -struct torture_suite *torture_base_locktest(void) +struct torture_suite *torture_base_locktest(TALLOC_CTX *mem_ctx) { - struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), - "LOCK"); + struct torture_suite *suite = torture_suite_create(mem_ctx, "LOCK"); torture_suite_add_2smb_test(suite, "LOCK1", torture_locktest1); torture_suite_add_1smb_test(suite, "LOCK2", torture_locktest2); torture_suite_add_2smb_test(suite, "LOCK3", torture_locktest3); diff --git a/source4/torture/basic/mangle_test.c b/source4/torture/basic/mangle_test.c index 665360fc64..d13450dd3a 100644 --- a/source4/torture/basic/mangle_test.c +++ b/source4/torture/basic/mangle_test.c @@ -155,8 +155,8 @@ static void gen_name(char *name) } -BOOL torture_mangle(struct torture_context *torture, - struct smbcli_state *cli) +bool torture_mangle(struct torture_context *torture, + struct smbcli_state *cli) { extern int torture_numops; int i; diff --git a/source4/torture/basic/properties.c b/source4/torture/basic/properties.c index 6a8e84cc2f..f389fa35f9 100644 --- a/source4/torture/basic/properties.c +++ b/source4/torture/basic/properties.c @@ -88,8 +88,8 @@ static void show_bits(const struct bitmapping *bm, uint32_t value) /* print out server properties */ -BOOL torture_test_properties(struct torture_context *torture, - struct smbcli_state *cli) +bool torture_test_properties(struct torture_context *torture, + struct smbcli_state *cli) { BOOL correct = True; union smb_fsinfo fs; diff --git a/source4/torture/basic/rename.c b/source4/torture/basic/rename.c index 572048e0ea..12fd5e1c99 100644 --- a/source4/torture/basic/rename.c +++ b/source4/torture/basic/rename.c @@ -27,8 +27,8 @@ /* Test rename on files open with share delete and no share delete. */ -BOOL torture_test_rename(struct torture_context *tctx, - struct smbcli_state *cli1) +bool torture_test_rename(struct torture_context *tctx, + struct smbcli_state *cli1) { const char *fname = "\\test.txt"; const char *fname1 = "\\test1.txt"; diff --git a/source4/torture/basic/unlink.c b/source4/torture/basic/unlink.c index 60d5a1554d..bb829051a2 100644 --- a/source4/torture/basic/unlink.c +++ b/source4/torture/basic/unlink.c @@ -33,7 +33,7 @@ 1) the server does not allow an unlink on a file that is open */ -BOOL torture_unlinktest(struct torture_context *tctx, struct smbcli_state *cli) +bool torture_unlinktest(struct torture_context *tctx, struct smbcli_state *cli) { const char *fname = BASEDIR "\\unlink.tst"; int fnum; diff --git a/source4/torture/nbench/nbio.c b/source4/torture/nbench/nbio.c index 9624a7b14f..e35b9d14ab 100644 --- a/source4/torture/nbench/nbio.c +++ b/source4/torture/nbench/nbio.c @@ -386,7 +386,7 @@ static struct smbcli_state *c; static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *private) { - struct smbcli_tree *tree = private; + struct smbcli_tree *tree = (struct smbcli_tree *)private; return smbcli_oplock_ack(tree, fnum, OPLOCK_BREAK_TO_NONE); } diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c index 2effe25ab7..ee97242de5 100644 --- a/source4/torture/nbt/dgram.c +++ b/source4/torture/nbt/dgram.c @@ -42,7 +42,7 @@ static void netlogon_handler(struct dgram_mailslot_handler *dgmslot, { NTSTATUS status; struct nbt_netlogon_packet netlogon; - int *replies = dgmslot->private; + int *replies = (int *)dgmslot->private; printf("netlogon reply from %s:%d\n", src->addr, src->port); @@ -227,7 +227,7 @@ static void ntlogon_handler(struct dgram_mailslot_handler *dgmslot, { NTSTATUS status; struct nbt_ntlogon_packet ntlogon; - int *replies = dgmslot->private; + int *replies = (int *)dgmslot->private; printf("ntlogon reply from %s:%d\n", src->addr, src->port); diff --git a/source4/torture/nbt/winsreplication.c b/source4/torture/nbt/winsreplication.c index 78f6352ed6..0d9e758647 100644 --- a/source4/torture/nbt/winsreplication.c +++ b/source4/torture/nbt/winsreplication.c @@ -220,7 +220,7 @@ static bool test_assoc_ctx2(struct torture_context *tctx) /* display a replication entry */ -static void display_entry(TALLOC_CTX *tctx, struct wrepl_name *name) +static void display_entry(struct torture_context *tctx, struct wrepl_name *name) { int i; @@ -537,8 +537,8 @@ static const struct wrepl_ip addresses_X_3_4[] = { } }; -static struct test_wrepl_conflict_conn *test_create_conflict_ctx(TALLOC_CTX *tctx, - const char *address) +static struct test_wrepl_conflict_conn *test_create_conflict_ctx( + struct torture_context *tctx, const char *address) { struct test_wrepl_conflict_conn *ctx; struct wrepl_associate associate; @@ -9450,7 +9450,8 @@ static void test_conflict_owned_active_vs_replica_handler_query(struct nbt_name_ { struct nbt_name *name; struct nbt_name_packet *rep_packet; - struct test_conflict_owned_active_vs_replica_struct *rec = nbtsock->incoming.private; + struct test_conflict_owned_active_vs_replica_struct *rec = + (struct test_conflict_owned_active_vs_replica_struct *)nbtsock->incoming.private; _NBT_ASSERT(req_packet->qdcount, 1); _NBT_ASSERT(req_packet->questions[0].question_type, NBT_QTYPE_NETBIOS); @@ -9546,7 +9547,8 @@ static void test_conflict_owned_active_vs_replica_handler_release( { struct nbt_name *name; struct nbt_name_packet *rep_packet; - struct test_conflict_owned_active_vs_replica_struct *rec = nbtsock->incoming.private; + struct test_conflict_owned_active_vs_replica_struct *rec = + (struct test_conflict_owned_active_vs_replica_struct *)nbtsock->incoming.private; _NBT_ASSERT(req_packet->qdcount, 1); _NBT_ASSERT(req_packet->questions[0].question_type, NBT_QTYPE_NETBIOS); @@ -9597,7 +9599,8 @@ static void test_conflict_owned_active_vs_replica_handler(struct nbt_name_socket struct nbt_name_packet *req_packet, struct socket_address *src) { - struct test_conflict_owned_active_vs_replica_struct *rec = nbtsock->incoming.private; + struct test_conflict_owned_active_vs_replica_struct *rec = + (struct test_conflict_owned_active_vs_replica_struct *)nbtsock->incoming.private; rec->defend.ret = false; diff --git a/source4/torture/raw/chkpath.c b/source4/torture/raw/chkpath.c index a56afee546..6240584a68 100644 --- a/source4/torture/raw/chkpath.c +++ b/source4/torture/raw/chkpath.c @@ -215,7 +215,7 @@ done: basic testing of chkpath calls */ bool torture_raw_chkpath(struct torture_context *torture, - struct smbcli_state *cli) + struct smbcli_state *cli) { bool ret = true; int fnum; diff --git a/source4/torture/raw/close.c b/source4/torture/raw/close.c index 34ac2f0db8..6f139f8530 100644 --- a/source4/torture/raw/close.c +++ b/source4/torture/raw/close.c @@ -28,7 +28,7 @@ * basic testing of all RAW_CLOSE_* calls */ bool torture_raw_close(struct torture_context *torture, - struct smbcli_state *cli) + struct smbcli_state *cli) { bool ret = true; union smb_close io; diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c index 374ff3cb98..e66ebcde02 100644 --- a/source4/torture/raw/composite.c +++ b/source4/torture/raw/composite.c @@ -400,7 +400,7 @@ static BOOL test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) basic testing of libcli composite calls */ bool torture_raw_composite(struct torture_context *tctx, - struct smbcli_state *cli) + struct smbcli_state *cli) { bool ret = true; diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index df7f5f3851..11cb91768b 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -886,7 +886,7 @@ static bool torture_raw_context_int(struct torture_context *tctx, basic testing of session/tree context calls */ bool torture_raw_context(struct torture_context *torture, - struct smbcli_state *cli) + struct smbcli_state *cli) { bool ret = true; if (lp_use_spnego()) { diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c index 7e9c742943..b6eedbc586 100644 --- a/source4/torture/raw/eas.c +++ b/source4/torture/raw/eas.c @@ -463,7 +463,7 @@ bool torture_raw_eas(struct torture_context *torture, struct smbcli_state *cli) /* test max EA size */ -BOOL torture_max_eas(struct torture_context *torture) +bool torture_max_eas(struct torture_context *torture) { struct smbcli_state *cli; BOOL ret = True; diff --git a/source4/torture/raw/ioctl.c b/source4/torture/raw/ioctl.c index 8e98822e11..357332c716 100644 --- a/source4/torture/raw/ioctl.c +++ b/source4/torture/raw/ioctl.c @@ -152,7 +152,7 @@ done: basic testing of some ioctl calls */ bool torture_raw_ioctl(struct torture_context *torture, - struct smbcli_state *cli) + struct smbcli_state *cli) { bool ret = true; diff --git a/source4/torture/raw/mkdir.c b/source4/torture/raw/mkdir.c index 0e2fd1afe0..071783a277 100644 --- a/source4/torture/raw/mkdir.c +++ b/source4/torture/raw/mkdir.c @@ -160,8 +160,8 @@ done: /* basic testing of all RAW_MKDIR_* calls */ -BOOL torture_raw_mkdir(struct torture_context *torture, - struct smbcli_state *cli) +bool torture_raw_mkdir(struct torture_context *torture, + struct smbcli_state *cli) { bool ret = true; diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c index 1540a4a2dd..7d0d46d3d1 100644 --- a/source4/torture/raw/notify.c +++ b/source4/torture/raw/notify.c @@ -1019,7 +1019,7 @@ done: static void tcp_dis_handler(struct smbcli_transport *t, void *p) { - struct smbcli_state *cli = p; + struct smbcli_state *cli = (struct smbcli_state *)p; smbcli_transport_dead(cli->transport, NT_STATUS_LOCAL_DISCONNECT); cli->transport = NULL; cli->tree = NULL; @@ -1284,8 +1284,8 @@ done: basic testing of change notify */ bool torture_raw_notify(struct torture_context *torture, - struct smbcli_state *cli, - struct smbcli_state *cli2) + struct smbcli_state *cli, + struct smbcli_state *cli2) { bool ret = true; diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c index 7a921af422..ad7676dcac 100644 --- a/source4/torture/raw/oplock.c +++ b/source4/torture/raw/oplock.c @@ -53,10 +53,11 @@ static struct { /* a handler function for oplock break requests. Ack it as a break to level II if possible */ -static BOOL oplock_handler_ack_to_levelII(struct smbcli_transport *transport, uint16_t tid, - uint16_t fnum, uint8_t level, void *private) +static bool oplock_handler_ack_to_levelII(struct smbcli_transport *transport, + uint16_t tid, uint16_t fnum, + uint8_t level, void *private) { - struct smbcli_tree *tree = private; + struct smbcli_tree *tree = (struct smbcli_tree *)private; break_info.fnum = fnum; break_info.level = level; break_info.count++; @@ -69,11 +70,11 @@ static BOOL oplock_handler_ack_to_levelII(struct smbcli_transport *transport, ui /* a handler function for oplock break requests. Ack it as a break to none */ -static BOOL oplock_handler_ack_to_none(struct smbcli_transport *transport, uint16_t tid, - uint16_t fnum, uint8_t level, - void *private) +static bool oplock_handler_ack_to_none(struct smbcli_transport *transport, + uint16_t tid, uint16_t fnum, + uint8_t level, void *private) { - struct smbcli_tree *tree = private; + struct smbcli_tree *tree = (struct smbcli_tree *)private; break_info.fnum = fnum; break_info.level = level; break_info.count++; @@ -100,7 +101,7 @@ static BOOL oplock_handler_close(struct smbcli_transport *transport, uint16_t ti uint16_t fnum, uint8_t level, void *private) { union smb_close io; - struct smbcli_tree *tree = private; + struct smbcli_tree *tree = (struct smbcli_tree *)private; struct smbcli_request *req; break_info.fnum = fnum; @@ -1406,10 +1407,11 @@ static struct hold_oplock_info { NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE, }, }; -static BOOL oplock_handler_hold(struct smbcli_transport *transport, uint16_t tid, - uint16_t fnum, uint8_t level, void *private) +static bool oplock_handler_hold(struct smbcli_transport *transport, + uint16_t tid, uint16_t fnum, uint8_t level, + void *private) { - struct smbcli_tree *tree = private; + struct smbcli_tree *tree = (struct smbcli_tree *)private; struct hold_oplock_info *info; int i; @@ -1444,7 +1446,8 @@ static BOOL oplock_handler_hold(struct smbcli_transport *transport, uint16_t tid BOOL torture_hold_oplock(struct torture_context *torture, struct smbcli_state *cli) { - struct event_context *ev = cli->transport->socket->event.ctx; + struct event_context *ev = + (struct event_context *)cli->transport->socket->event.ctx; int i; printf("Setting up open files with oplocks in %s\n", BASEDIR); diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c index f1048f25ac..3c108dce2d 100644 --- a/source4/torture/raw/read.c +++ b/source4/torture/raw/read.c @@ -93,7 +93,7 @@ static bool test_read(struct torture_context *tctx, struct smbcli_state *cli) const char *test_data = "TEST DATA"; uint_t seed = time(NULL); - buf = talloc_zero_size(tctx, maxsize); + buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { return False; @@ -220,7 +220,7 @@ static bool test_lockread(struct torture_context *tctx, const char *test_data = "TEST DATA"; uint_t seed = time(NULL); - buf = talloc_zero_size(tctx, maxsize); + buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { return False; @@ -365,7 +365,7 @@ static bool test_readx(struct torture_context *tctx, struct smbcli_state *cli) const char *test_data = "TEST DATA"; uint_t seed = time(NULL); - buf = talloc_zero_size(tctx, maxsize); + buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { return False; @@ -604,7 +604,7 @@ static bool test_readbraw(struct torture_context *tctx, const char *test_data = "TEST DATA"; uint_t seed = time(NULL); - buf = talloc_zero_size(tctx, maxsize); + buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { return False; @@ -778,7 +778,7 @@ static bool test_read_for_execute(struct torture_context *tctx, const char *fname = BASEDIR "\\test.txt"; const uint8_t data[] = "TEST DATA"; - buf = talloc_zero_size(tctx, maxsize); + buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { return False; diff --git a/source4/torture/raw/samba3hide.c b/source4/torture/raw/samba3hide.c index 3fe151f009..309f65487a 100644 --- a/source4/torture/raw/samba3hide.c +++ b/source4/torture/raw/samba3hide.c @@ -125,7 +125,7 @@ static NTSTATUS smbcli_chmod(struct smbcli_tree *tree, const char *fname, return smb_raw_setpathinfo(tree, &sfinfo); } -BOOL torture_samba3_hide(struct torture_context *torture) +bool torture_samba3_hide(struct torture_context *torture) { struct smbcli_state *cli; const char *fname = "test.txt"; @@ -274,7 +274,7 @@ BOOL torture_samba3_hide(struct torture_context *torture) * close. smb_close should return NT_STATUS_ACCESS_DENIED. */ -BOOL torture_samba3_closeerr(struct torture_context *tctx) +bool torture_samba3_closeerr(struct torture_context *tctx) { struct smbcli_state *cli = NULL; BOOL result = False; diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index e1b1fcaf6d..57595dab44 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -34,7 +34,7 @@ } \ } while (0) -BOOL torture_samba3_checkfsp(struct torture_context *torture) +bool torture_samba3_checkfsp(struct torture_context *torture) { struct smbcli_state *cli; const char *fname = "test.txt"; @@ -323,7 +323,7 @@ static NTSTATUS raw_smbcli_ntcreate(struct smbcli_tree *tree, const char *fname, } -BOOL torture_samba3_badpath(struct torture_context *torture) +bool torture_samba3_badpath(struct torture_context *torture) { struct smbcli_state *cli_nt; struct smbcli_state *cli_dos; @@ -607,7 +607,7 @@ static void count_fn(struct clilist_file_info *info, const char *name, *counter += 1; } -BOOL torture_samba3_caseinsensitive(struct torture_context *torture) +bool torture_samba3_caseinsensitive(struct torture_context *torture) { struct smbcli_state *cli; TALLOC_CTX *mem_ctx; @@ -672,7 +672,7 @@ BOOL torture_samba3_caseinsensitive(struct torture_context *torture) * on an underlying file */ -BOOL torture_samba3_posixtimedlock(struct torture_context *tctx) +bool torture_samba3_posixtimedlock(struct torture_context *tctx) { struct smbcli_state *cli; NTSTATUS status; diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c index b1931d9359..7b6529245b 100644 --- a/source4/torture/raw/search.c +++ b/source4/torture/raw/search.c @@ -32,7 +32,7 @@ */ static BOOL single_search_callback(void *private, const union smb_search_data *file) { - union smb_search_data *data = private; + union smb_search_data *data = (union smb_search_data *)private; *data = *file; @@ -511,7 +511,7 @@ struct multiple_result { */ static BOOL multiple_search_callback(void *private, const union smb_search_data *file) { - struct multiple_result *data = private; + struct multiple_result *data = (struct multiple_result *)private; data->count++; @@ -541,7 +541,7 @@ static NTSTATUS multiple_search(struct smbcli_state *cli, union smb_search_next io2; NTSTATUS status; const int per_search = 100; - struct multiple_result *result = data; + struct multiple_result *result = (struct multiple_result *)data; if (data_level == RAW_SEARCH_DATA_SEARCH) { io.search_first.level = RAW_SEARCH_SEARCH; diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c index 24428efcf7..c51c6ea2df 100644 --- a/source4/torture/raw/streams.c +++ b/source4/torture/raw/streams.c @@ -73,7 +73,7 @@ static BOOL check_stream(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, return False; } - buf = talloc_size(mem_ctx, strlen(value)+11); + buf = talloc_array(mem_ctx, uint8_t, strlen(value)+11); ret = smbcli_read(cli->tree, fnum, buf, 0, strlen(value)+11); if (ret != strlen(value)) { diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c index c307b14e08..860a09727d 100644 --- a/source4/torture/raw/unlink.c +++ b/source4/torture/raw/unlink.c @@ -439,8 +439,7 @@ done: */ struct torture_suite *torture_raw_unlink(TALLOC_CTX *mem_ctx) { - struct torture_suite *suite = torture_suite_create(mem_ctx, - "UNLINK"); + struct torture_suite *suite = torture_suite_create(mem_ctx, "UNLINK"); torture_suite_add_1smb_test(suite, "unlink", test_unlink); torture_suite_add_1smb_test(suite, "delete_on_close", test_delete_on_close); diff --git a/source4/torture/raw/write.c b/source4/torture/raw/write.c index b704a19ed6..6151c60a71 100644 --- a/source4/torture/raw/write.c +++ b/source4/torture/raw/write.c @@ -108,7 +108,7 @@ static bool test_write(struct torture_context *tctx, uint_t seed = time(NULL); union smb_fileinfo finfo; - buf = talloc_zero_size(tctx, maxsize); + buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { return False; @@ -242,7 +242,7 @@ static bool test_writex(struct torture_context *tctx, torture_comment(tctx, "dangerous not set - limiting range of test to 2^%d\n", max_bits); } - buf = talloc_zero_size(tctx, maxsize); + buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { return False; @@ -424,7 +424,7 @@ static bool test_writeunlock(struct torture_context *tctx, uint_t seed = time(NULL); union smb_fileinfo finfo; - buf = talloc_zero_size(tctx, maxsize); + buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { return False; @@ -567,7 +567,7 @@ static bool test_writeclose(struct torture_context *tctx, uint_t seed = time(NULL); union smb_fileinfo finfo; - buf = talloc_zero_size(tctx, maxsize); + buf = talloc_zero_array(tctx, uint8_t, maxsize); if (!torture_setup_dir(cli, BASEDIR)) { return False; diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c index f999995daf..4ce8fc6d3f 100644 --- a/source4/utils/ntlm_auth.c +++ b/source4/utils/ntlm_auth.c @@ -244,7 +244,7 @@ static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode, char *user, *pass; user=buf; - pass=memchr(buf,' ',length); + pass = memchr(buf, ' ', length); if (!pass) { DEBUG(2, ("Password not found. Denying access\n")); mux_printf(mux_id, "ERR\n"); @@ -367,7 +367,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, TALLOC_CTX *mem_ctx; if (*private) { - state = *private; + state = (struct gensec_ntlm_state *)*private; } else { state = talloc_zero(NULL, struct gensec_ntlm_state); if (!state) { |