summaryrefslogtreecommitdiff
path: root/source3/smbd/negprot.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2018-03-22 11:49:18 +0100
committerJeremy Allison <jra@samba.org>2018-04-03 20:20:10 +0200
commit06940155f315529c5b523f8bacdaf60036254bdc (patch)
treea75d45972ae7ecf38cbb116695ef8d3ff0602a74 /source3/smbd/negprot.c
parentabc9c56021db877a23f934805df0589d7a1b99f4 (diff)
downloadsamba-06940155f315529c5b523f8bacdaf60036254bdc.tar.gz
s3:smbd: Fix size types in reply_negprot()
This fixes compilation with -Wstrict-overflow=2. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd/negprot.c')
-rw-r--r--source3/smbd/negprot.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index a36822e1907..27366ea0013 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -557,14 +557,15 @@ static const struct {
void reply_negprot(struct smb_request *req)
{
- int choice= -1;
+ size_t choice = 0;
int chosen_level = -1;
+ bool choice_set = false;
int protocol;
const char *p;
int protocols = 0;
int num_cliprotos;
char **cliprotos;
- int i;
+ size_t i;
size_t converted_size;
struct smbXsrv_connection *xconn = req->xconn;
struct smbd_server_connection *sconn = req->sconn;
@@ -733,14 +734,16 @@ void reply_negprot(struct smb_request *req)
if (strequal(cliprotos[i],supported_protocols[protocol].proto_name)) {
choice = i;
chosen_level = supported_protocols[protocol].protocol_level;
+ choice_set = true;
}
i++;
}
- if(choice != -1)
+ if (choice_set) {
break;
+ }
}
- if (choice == -1) {
+ if (!choice_set) {
bool ok;
DBG_NOTICE("No protocol supported !\n");
@@ -760,7 +763,7 @@ void reply_negprot(struct smb_request *req)
supported_protocols[protocol].proto_reply_fn(req, choice);
DEBUG(3,("Selected protocol %s\n",supported_protocols[protocol].proto_name));
- DEBUG( 5, ( "negprot index=%d\n", choice ) );
+ DBG_INFO("negprot index=%zu\n", choice);
/* We always have xconn->smb1.signing_state also for >= SMB2_02 */
signing_required = smb_signing_is_mandatory(xconn->smb1.signing_state);