From 21528da9cd12a4f5c3792a482a5d18fe946a6f7a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 17 Feb 2012 14:12:40 -0800 Subject: Fix a bunch of "unused variable" warnings. Autobuild-User: Jeremy Allison Autobuild-Date: Sat Feb 18 06:22:40 CET 2012 on sn-devel-104 --- source3/lib/charcnv.c | 74 ------------------------------------- source3/librpc/crypto/gse.c | 12 +++--- source3/libsmb/clisymlink.c | 7 ++-- source3/printing/print_iprint.c | 5 --- source3/smbd/process.c | 3 -- source3/smbd/reply.c | 2 - source3/smbd/smb2_close.c | 2 - source3/smbd/smb2_create.c | 4 -- source3/smbd/smb2_find.c | 4 -- source3/smbd/smb2_getinfo.c | 4 -- source3/smbd/smb2_ioctl.c | 3 -- source3/smbd/smb2_notify.c | 3 -- source3/smbd/smb2_read.c | 4 -- source3/smbd/smb2_server.c | 2 - source3/smbd/smb2_write.c | 4 -- source3/smbd/trans2.c | 2 - source3/winbindd/wb_group_members.c | 4 +- source3/winbindd/winbindd_cache.c | 3 -- source3/winbindd/winbindd_rpc.c | 2 - 19 files changed, 11 insertions(+), 133 deletions(-) diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index ecf62e551a..5863d72f38 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -297,80 +297,6 @@ static size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_ return len; } - - -/** - Copy a string from a ucs2 source to a unix char* destination. - Flags can have: - STR_TERMINATE means the string in src is null terminated. - STR_NOALIGN means don't try to align. - if STR_TERMINATE is set then src_len is ignored if it is -1. - src_len is the length of the source area in bytes - Return the number of bytes occupied by the string in src. - The resulting string in "dest" is always null terminated. -**/ - -static size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags) -{ - size_t size = 0; - size_t ucs2_align_len = 0; - bool ret; - - if (dest_len == (size_t)-1) { - /* No longer allow dest_len of -1. */ - smb_panic("pull_ucs2 - invalid dest_len of -1"); - } - - if (!src_len) { - if (dest && dest_len > 0) { - dest[0] = '\0'; - } - return 0; - } - - if (ucs2_align(base_ptr, src, flags)) { - src = (const void *)((const char *)src + 1); - if (src_len != (size_t)-1) - src_len--; - ucs2_align_len = 1; - } - - if (flags & STR_TERMINATE) { - /* src_len -1 is the default for null terminated strings. */ - if (src_len != (size_t)-1) { - size_t len = strnlen_w((const smb_ucs2_t *)src, - src_len/2); - if (len < src_len/2) - len++; - src_len = len*2; - } - } - - /* ucs2 is always a multiple of 2 bytes */ - if (src_len != (size_t)-1) - src_len &= ~1; - - ret = convert_string(CH_UTF16LE, CH_UNIX, src, src_len, dest, dest_len, &size); - if (ret == false) { - size = 0; - dest_len = 0; - } - - if (src_len == (size_t)-1) - src_len = size*2; - - if (dest_len && size) { - /* Did we already process the terminating zero ? */ - if (dest[MIN(size-1, dest_len-1)] != 0) { - dest[MIN(size, dest_len-1)] = 0; - } - } else { - dest[0] = 0; - } - - return src_len + ucs2_align_len; -} - /** Copy a string from a ucs2 source to a unix char* destination. Talloc version with a base pointer. diff --git a/source3/librpc/crypto/gse.c b/source3/librpc/crypto/gse.c index 1ce3761ae7..9c18443206 100644 --- a/source3/librpc/crypto/gse.c +++ b/source3/librpc/crypto/gse.c @@ -78,7 +78,7 @@ static bool gss_oid_equal(const gss_OID o1, const gss_OID o2) static int gse_context_destructor(void *ptr) { struct gse_context *gse_ctx; - OM_uint32 gss_min, gss_maj; + OM_uint32 gss_min; gse_ctx = talloc_get_type_abort(ptr, struct gse_context); if (gse_ctx->k5ctx) { @@ -94,24 +94,24 @@ static int gse_context_destructor(void *ptr) gse_ctx->k5ctx = NULL; } if (gse_ctx->gssapi_context != GSS_C_NO_CONTEXT) { - gss_maj = gss_delete_sec_context(&gss_min, + (void)gss_delete_sec_context(&gss_min, &gse_ctx->gssapi_context, GSS_C_NO_BUFFER); } if (gse_ctx->server_name) { - gss_maj = gss_release_name(&gss_min, + (void)gss_release_name(&gss_min, &gse_ctx->server_name); } if (gse_ctx->client_name) { - gss_maj = gss_release_name(&gss_min, + (void)gss_release_name(&gss_min, &gse_ctx->client_name); } if (gse_ctx->creds) { - gss_maj = gss_release_cred(&gss_min, + (void)gss_release_cred(&gss_min, &gse_ctx->creds); } if (gse_ctx->delegated_cred_handle) { - gss_maj = gss_release_cred(&gss_min, + (void)gss_release_cred(&gss_min, &gse_ctx->delegated_cred_handle); } diff --git a/source3/libsmb/clisymlink.c b/source3/libsmb/clisymlink.c index fad9826880..9e21d1b883 100644 --- a/source3/libsmb/clisymlink.c +++ b/source3/libsmb/clisymlink.c @@ -156,15 +156,14 @@ static void cli_symlink_delete_on_close_done(struct tevent_req *subreq) subreq, struct tevent_req); struct cli_symlink_state *state = tevent_req_data( req, struct cli_symlink_state); - NTSTATUS status; - - status = cli_nt_delete_on_close_recv(subreq); - TALLOC_FREE(subreq); /* * Ignore status, we can't do much anyway in case of failure */ + (void)cli_nt_delete_on_close_recv(subreq); + TALLOC_FREE(subreq); + subreq = cli_close_send(state, state->ev, state->cli, state->fnum); if (tevent_req_nomem(subreq, req)) { return; diff --git a/source3/printing/print_iprint.c b/source3/printing/print_iprint.c index 1392cba7b8..1ff705a383 100644 --- a/source3/printing/print_iprint.c +++ b/source3/printing/print_iprint.c @@ -866,7 +866,6 @@ static int iprint_queue_get(const char *sharename, int job_id; /* job-id attribute */ int job_k_octets; /* job-k-octets attribute */ time_t job_time; /* time-at-creation attribute */ - time_t printer_current_time = 0; /* printer's current time */ time_t printer_up_time = 0; /* printer's uptime */ ipp_jstate_t job_status; /* job-status attribute */ int job_priority; /* job-priority attribute */ @@ -993,10 +992,6 @@ static int iprint_queue_get(const char *sharename, IPP_TAG_TEXT)) != NULL) fstrcpy(status->message, attr->values[0].string.text); - if ((attr = ippFindAttribute(response, "printer-current-time", - IPP_TAG_DATE)) != NULL) - printer_current_time = ippDateToTime(attr->values[0].date); - if ((attr = ippFindAttribute(response, "printer-up-time", IPP_TAG_INTEGER)) != NULL) printer_up_time = attr->values[0].integer; diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 1d74355289..139f1f0d22 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -2646,7 +2646,6 @@ static bool smbd_echo_reply(struct smbd_echo_state *state, { struct smb_request req; uint16_t num_replies; - size_t out_len; char *outbuf; bool ok; @@ -2703,8 +2702,6 @@ static bool smbd_echo_reply(struct smbd_echo_state *state, memcpy(smb_buf(req.outbuf), req.buf, req.buflen); } - out_len = smb_len(req.outbuf) + 4; - ok = srv_send_smb(req.sconn, (char *)outbuf, true, seqnum+1, diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 557a32f054..b026d34c67 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3525,10 +3525,8 @@ static int setup_readX_header(struct smb_request *req, char *outbuf, size_t smb_maxcnt) { int outsize; - char *data; outsize = srv_set_message(outbuf,12,smb_maxcnt,False); - data = smb_buf(outbuf); memset(outbuf+smb_vwv0,'\0',24); /* valgrind init. */ diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c index ffe08cc8ac..2cc8266fe1 100644 --- a/source3/smbd/smb2_close.c +++ b/source3/smbd/smb2_close.c @@ -32,7 +32,6 @@ NTSTATUS smbd_smb2_request_process_close(struct smbd_smb2_request *req) { const uint8_t *inbody; int i = req->current_idx; - uint8_t *outhdr; DATA_BLOB outbody; uint16_t in_flags; uint64_t in_file_id_persistent; @@ -68,7 +67,6 @@ NTSTATUS smbd_smb2_request_process_close(struct smbd_smb2_request *req) return smbd_smb2_request_error(req, status); } - outhdr = (uint8_t *)req->out.vector[i].iov_base; return smbd_smb2_request_done(req, outbody, NULL); } diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c index c637adbb61..3e5b81d5c8 100644 --- a/source3/smbd/smb2_create.c +++ b/source3/smbd/smb2_create.c @@ -264,8 +264,6 @@ static void smbd_smb2_request_create_done(struct tevent_req *tsubreq) { struct smbd_smb2_request *smb2req = tevent_req_callback_data(tsubreq, struct smbd_smb2_request); - int i = smb2req->current_idx; - uint8_t *outhdr; DATA_BLOB outbody; DATA_BLOB outdyn; uint8_t out_oplock_level = 0; @@ -337,8 +335,6 @@ static void smbd_smb2_request_create_done(struct tevent_req *tsubreq) out_context_buffer_offset = SMB2_HDR_BODY + 0x58; } - outhdr = (uint8_t *)smb2req->out.vector[i].iov_base; - outbody = data_blob_talloc(smb2req->out.vector, NULL, 0x58); if (outbody.data == NULL) { error = smbd_smb2_request_error(smb2req, NT_STATUS_NO_MEMORY); diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c index 671b5f5a75..7c19d7538a 100644 --- a/source3/smbd/smb2_find.c +++ b/source3/smbd/smb2_find.c @@ -142,8 +142,6 @@ static void smbd_smb2_request_find_done(struct tevent_req *subreq) { struct smbd_smb2_request *req = tevent_req_callback_data(subreq, struct smbd_smb2_request); - int i = req->current_idx; - uint8_t *outhdr; DATA_BLOB outbody; DATA_BLOB outdyn; uint16_t out_output_buffer_offset; @@ -167,8 +165,6 @@ static void smbd_smb2_request_find_done(struct tevent_req *subreq) out_output_buffer_offset = SMB2_HDR_BODY + 0x08; - outhdr = (uint8_t *)req->out.vector[i].iov_base; - outbody = data_blob_talloc(req->out.vector, NULL, 0x08); if (outbody.data == NULL) { error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY); diff --git a/source3/smbd/smb2_getinfo.c b/source3/smbd/smb2_getinfo.c index 340130e2a5..7d0f946898 100644 --- a/source3/smbd/smb2_getinfo.c +++ b/source3/smbd/smb2_getinfo.c @@ -125,8 +125,6 @@ static void smbd_smb2_request_getinfo_done(struct tevent_req *subreq) { struct smbd_smb2_request *req = tevent_req_callback_data(subreq, struct smbd_smb2_request); - int i = req->current_idx; - uint8_t *outhdr; DATA_BLOB outbody; DATA_BLOB outdyn; uint16_t out_output_buffer_offset; @@ -166,8 +164,6 @@ static void smbd_smb2_request_getinfo_done(struct tevent_req *subreq) out_output_buffer_offset = SMB2_HDR_BODY + 0x08; - outhdr = (uint8_t *)req->out.vector[i].iov_base; - outbody = data_blob_talloc(req->out.vector, NULL, 0x08); if (outbody.data == NULL) { error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY); diff --git a/source3/smbd/smb2_ioctl.c b/source3/smbd/smb2_ioctl.c index 56d9a3267f..d537a8798c 100644 --- a/source3/smbd/smb2_ioctl.c +++ b/source3/smbd/smb2_ioctl.c @@ -119,7 +119,6 @@ static void smbd_smb2_request_ioctl_done(struct tevent_req *subreq) struct smbd_smb2_request); const uint8_t *inbody; int i = req->current_idx; - uint8_t *outhdr; DATA_BLOB outbody; DATA_BLOB outdyn; uint32_t in_ctl_code; @@ -160,8 +159,6 @@ static void smbd_smb2_request_ioctl_done(struct tevent_req *subreq) in_file_id_persistent = BVAL(inbody, 0x08); in_file_id_volatile = BVAL(inbody, 0x10); - outhdr = (uint8_t *)req->out.vector[i].iov_base; - outbody = data_blob_talloc(req->out.vector, NULL, 0x30); if (outbody.data == NULL) { error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY); diff --git a/source3/smbd/smb2_notify.c b/source3/smbd/smb2_notify.c index 0ea0b09636..49051bfe62 100644 --- a/source3/smbd/smb2_notify.c +++ b/source3/smbd/smb2_notify.c @@ -103,7 +103,6 @@ static void smbd_smb2_request_notify_done(struct tevent_req *subreq) struct smbd_smb2_request *req = tevent_req_callback_data(subreq, struct smbd_smb2_request); int i = req->current_idx; - uint8_t *outhdr; DATA_BLOB outbody; DATA_BLOB outdyn; uint16_t out_output_buffer_offset; @@ -145,8 +144,6 @@ static void smbd_smb2_request_notify_done(struct tevent_req *subreq) out_output_buffer_offset = SMB2_HDR_BODY + 0x08; - outhdr = (uint8_t *)req->out.vector[i].iov_base; - outbody = data_blob_talloc(req->out.vector, NULL, 0x08); if (outbody.data == NULL) { error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY); diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c index 358d307427..13bcbdfd19 100644 --- a/source3/smbd/smb2_read.c +++ b/source3/smbd/smb2_read.c @@ -107,8 +107,6 @@ static void smbd_smb2_request_read_done(struct tevent_req *subreq) { struct smbd_smb2_request *req = tevent_req_callback_data(subreq, struct smbd_smb2_request); - int i = req->current_idx; - uint8_t *outhdr; DATA_BLOB outbody; DATA_BLOB outdyn; uint8_t out_data_offset; @@ -134,8 +132,6 @@ static void smbd_smb2_request_read_done(struct tevent_req *subreq) out_data_offset = SMB2_HDR_BODY + 0x10; - outhdr = (uint8_t *)req->out.vector[i].iov_base; - outbody = data_blob_talloc(req->out.vector, NULL, 0x10); if (outbody.data == NULL) { error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY); diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index a51e26ddb9..899de07c23 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -554,7 +554,6 @@ static NTSTATUS smbd_smb2_request_setup_out(struct smbd_smb2_request *req) for (idx=1; idx < count; idx += 3) { const uint8_t *inhdr = NULL; - uint32_t in_flags; uint8_t *outhdr = NULL; uint8_t *outbody = NULL; uint32_t next_command_ofs = 0; @@ -567,7 +566,6 @@ static NTSTATUS smbd_smb2_request_setup_out(struct smbd_smb2_request *req) } inhdr = (const uint8_t *)req->in.vector[idx].iov_base; - in_flags = IVAL(inhdr, SMB2_HDR_FLAGS); outhdr = talloc_zero_array(vector, uint8_t, OUTVEC_ALLOC_SIZE); diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c index 23e344f6a0..49a77e63a9 100644 --- a/source3/smbd/smb2_write.c +++ b/source3/smbd/smb2_write.c @@ -114,8 +114,6 @@ static void smbd_smb2_request_write_done(struct tevent_req *subreq) { struct smbd_smb2_request *req = tevent_req_callback_data(subreq, struct smbd_smb2_request); - int i = req->current_idx; - uint8_t *outhdr; DATA_BLOB outbody; DATA_BLOB outdyn; uint32_t out_count = 0; @@ -134,8 +132,6 @@ static void smbd_smb2_request_write_done(struct tevent_req *subreq) return; } - outhdr = (uint8_t *)req->out.vector[i].iov_base; - outbody = data_blob_talloc(req->out.vector, NULL, 0x10); if (outbody.data == NULL) { error = smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index cee6c35189..336e76e481 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1539,7 +1539,6 @@ static bool smbd_marshall_dir_entry(TALLOC_CTX *ctx, uint32_t len; struct timespec mdate_ts, adate_ts, cdate_ts, create_date_ts; time_t mdate = (time_t)0, adate = (time_t)0, create_date = (time_t)0; - time_t c_date = (time_t)0; char *nameptr; char *last_entry_ptr; bool was_8_3; @@ -1575,7 +1574,6 @@ static bool smbd_marshall_dir_entry(TALLOC_CTX *ctx, create_date = convert_timespec_to_time_t(create_date_ts); mdate = convert_timespec_to_time_t(mdate_ts); adate = convert_timespec_to_time_t(adate_ts); - c_date = convert_timespec_to_time_t(cdate_ts); /* align the record */ SMB_ASSERT(align >= 1); diff --git a/source3/winbindd/wb_group_members.c b/source3/winbindd/wb_group_members.c index 8776a8c7dd..e4b4c0ac33 100644 --- a/source3/winbindd/wb_group_members.c +++ b/source3/winbindd/wb_group_members.c @@ -355,7 +355,7 @@ static void wb_group_members_done(struct tevent_req *subreq) subreq, struct tevent_req); struct wb_group_members_state *state = tevent_req_data( req, struct wb_group_members_state); - int i, num_groups, new_users, new_groups; + int i, num_groups, new_groups; int num_members = 0; struct wbint_Principal *members = NULL; NTSTATUS status; @@ -366,7 +366,7 @@ static void wb_group_members_done(struct tevent_req *subreq) return; } - new_users = new_groups = 0; + new_groups = 0; for (i=0; i