1 From a68b8b418bfc42c628fee605cc52dca92ab410c9 Mon Sep 17 00:00:00 2001
2 From: Robbie Harwood <rharwood@redhat.com>
3 Date: Wed, 15 Mar 2017 14:52:08 -0400
4 Subject: [PATCH] Fix mismatched sign comparisons
6 We are c99, so also migrate to `for`-loop initializers where possible for
9 Signed-off-by: Robbie Harwood <rharwood@redhat.com>
10 Reviewed-by: Simo Sorce <simo@redhat.com>
12 (cherry picked from commit 377e92c7ead312c530b233a1e023493ecde033d6)
14 proxy/src/client/gpm_acquire_cred.c | 11 ++-----
15 proxy/src/client/gpm_common.c | 4 +--
16 proxy/src/client/gpm_import_and_canon_name.c | 7 ++---
17 proxy/src/client/gpm_indicate_mechs.c | 33 +++++++++-----------
18 proxy/src/gp_common.h | 3 +-
19 proxy/src/gp_config.c | 9 ++----
20 proxy/src/gp_conv.c | 6 ++--
21 proxy/src/gp_creds.c | 3 +-
22 proxy/src/gp_export.c | 9 ++----
23 proxy/src/gp_rpc_acquire_cred.c | 5 ++-
24 proxy/src/gp_rpc_debug.c | 26 +++++++--------
25 proxy/src/gp_rpc_indicate_mechs.c | 15 +++------
26 proxy/src/gp_socket.c | 4 +--
27 proxy/src/gp_util.c | 4 +--
28 proxy/tests/t_utils.c | 4 +--
29 15 files changed, 58 insertions(+), 85 deletions(-)
31 diff --git a/proxy/src/client/gpm_acquire_cred.c b/proxy/src/client/gpm_acquire_cred.c
32 index 632973d..8e30e1d 100644
33 --- a/proxy/src/client/gpm_acquire_cred.c
34 +++ b/proxy/src/client/gpm_acquire_cred.c
35 @@ -6,8 +6,6 @@ static int gpmint_cred_to_actual_mechs(gssx_cred *c, gss_OID_set *a)
38 gss_OID_set m = GSS_C_NO_OID_SET;
42 if (c->elements.elements_len) {
44 @@ -22,7 +20,7 @@ static int gpmint_cred_to_actual_mechs(gssx_cred *c, gss_OID_set *a)
48 - for (i = 0; i < c->elements.elements_len; i++) {
49 + for (unsigned i = 0; i < c->elements.elements_len; i++) {
50 e = &c->elements.elements_val[i];
52 m->elements[i].elements = gp_memdup(e->mech.octet_string_val,
53 @@ -280,7 +278,6 @@ OM_uint32 gpm_inquire_cred(OM_uint32 *minor_status,
54 uint32_t ret_maj = GSS_S_COMPLETE;
61 @@ -308,8 +305,7 @@ OM_uint32 gpm_inquire_cred(OM_uint32 *minor_status,
62 life = GSS_C_INDEFINITE;
65 - for (i = 0; i < cred->elements.elements_len; i++) {
67 + for (unsigned i = 0; i < cred->elements.elements_len; i++) {
68 e = &cred->elements.elements_val[i];
70 switch (e->cred_usage) {
71 @@ -402,7 +398,7 @@ OM_uint32 gpm_inquire_cred_by_mech(OM_uint32 *minor_status,
74 uint32_t ret_maj = GSS_S_COMPLETE;
80 @@ -414,7 +410,6 @@ OM_uint32 gpm_inquire_cred_by_mech(OM_uint32 *minor_status,
83 for (i = 0; i < cred->elements.elements_len; i++) {
85 e = &cred->elements.elements_val[i];
86 gp_conv_gssx_to_oid(&e->mech, &tmp_oid);
87 if (!gss_oid_equal(&tmp_oid, mech_type)) {
88 diff --git a/proxy/src/client/gpm_common.c b/proxy/src/client/gpm_common.c
89 index 030765a..8c96986 100644
90 --- a/proxy/src/client/gpm_common.c
91 +++ b/proxy/src/client/gpm_common.c
92 @@ -166,7 +166,7 @@ static int gpm_send_buffer(struct gpm_ctx *gpmctx,
93 char *buffer, uint32_t length)
101 @@ -232,7 +232,7 @@ static int gpm_recv_buffer(struct gpm_ctx *gpmctx,
102 char *buffer, uint32_t *length)
110 diff --git a/proxy/src/client/gpm_import_and_canon_name.c b/proxy/src/client/gpm_import_and_canon_name.c
111 index 83d0736..70149a3 100644
112 --- a/proxy/src/client/gpm_import_and_canon_name.c
113 +++ b/proxy/src/client/gpm_import_and_canon_name.c
114 @@ -275,7 +275,6 @@ OM_uint32 gpm_inquire_name(OM_uint32 *minor_status,
116 gss_buffer_set_t xattrs = GSS_C_NO_BUFFER_SET;
122 @@ -306,13 +305,13 @@ OM_uint32 gpm_inquire_name(OM_uint32 *minor_status,
123 *minor_status = ENOMEM;
124 return GSS_S_FAILURE;
126 - for (i = 0; i < xattrs->count; i++) {
127 + for (unsigned i = 0; i < xattrs->count; i++) {
128 ret = gp_copy_gssx_to_buffer(
129 &name->name_attributes.name_attributes_val[i].attr,
130 &xattrs->elements[i]);
132 - for (--i; i >= 0; i--) {
133 - free(xattrs->elements[i].value);
134 + for (; i > 0; i--) {
135 + free(xattrs->elements[i-1].value);
137 free(xattrs->elements);
139 diff --git a/proxy/src/client/gpm_indicate_mechs.c b/proxy/src/client/gpm_indicate_mechs.c
140 index d4df923..b019a96 100644
141 --- a/proxy/src/client/gpm_indicate_mechs.c
142 +++ b/proxy/src/client/gpm_indicate_mechs.c
143 @@ -51,7 +51,6 @@ static uint32_t gpm_copy_gss_OID_set(uint32_t *minor_status,
149 ret_maj = gss_create_empty_oid_set(&ret_min, &n);
151 @@ -59,7 +58,7 @@ static uint32_t gpm_copy_gss_OID_set(uint32_t *minor_status,
155 - for (i = 0; i < oldset->count; i++) {
156 + for (size_t i = 0; i < oldset->count; i++) {
157 ret_maj = gss_add_oid_set_member(&ret_min, &oldset->elements[i], &n);
159 *minor_status = ret_min;
160 @@ -124,7 +123,6 @@ static void gpmint_indicate_mechs(void)
162 uint32_t ret_maj = 0;
166 memset(arg, 0, sizeof(gssx_arg_indicate_mechs));
167 memset(res, 0, sizeof(gssx_res_indicate_mechs));
168 @@ -158,7 +156,7 @@ static void gpmint_indicate_mechs(void)
172 - for (i = 0; i < res->mechs.mechs_len; i++) {
173 + for (unsigned i = 0; i < res->mechs.mechs_len; i++) {
174 mi = &res->mechs.mechs_val[i];
175 gi = &global_mechs.info[i];
177 @@ -222,7 +220,7 @@ static void gpmint_indicate_mechs(void)
181 - for (i = 0; i < res->mech_attr_descs.mech_attr_descs_len; i++) {
182 + for (unsigned i = 0; i < res->mech_attr_descs.mech_attr_descs_len; i++) {
183 ma = &res->mech_attr_descs.mech_attr_descs_val[i];
184 ga = &global_mechs.desc[i];
186 @@ -249,7 +247,7 @@ static void gpmint_indicate_mechs(void)
189 if (ret || ret_maj) {
190 - for (i = 0; i < global_mechs.desc_len; i++) {
191 + for (unsigned i = 0; i < global_mechs.desc_len; i++) {
192 ga = &global_mechs.desc[i];
193 gss_release_oid(&discard, &ga->attr);
194 gss_release_buffer(&discard, ga->name);
195 @@ -258,7 +256,7 @@ done:
197 free(global_mechs.desc);
198 global_mechs.desc = NULL;
199 - for (i = 0; i < global_mechs.info_len; i++) {
200 + for (unsigned i = 0; i < global_mechs.info_len; i++) {
201 gi = &global_mechs.info[i];
202 gss_release_oid(&discard, &gi->mech);
203 gss_release_oid_set(&discard, &gi->name_types);
204 @@ -335,7 +333,6 @@ OM_uint32 gpm_inquire_names_for_mech(OM_uint32 *minor_status,
211 return GSS_S_CALL_INACCESSIBLE_WRITE;
212 @@ -351,7 +348,7 @@ OM_uint32 gpm_inquire_names_for_mech(OM_uint32 *minor_status,
213 return GSS_S_FAILURE;
216 - for (i = 0; i < global_mechs.info_len; i++) {
217 + for (unsigned i = 0; i < global_mechs.info_len; i++) {
218 if (!gpm_equal_oids(global_mechs.info[i].mech, mech_type)) {
221 @@ -375,7 +372,6 @@ OM_uint32 gpm_inquire_mechs_for_name(OM_uint32 *minor_status,
223 gss_OID name_type = GSS_C_NO_OID;
228 return GSS_S_CALL_INACCESSIBLE_WRITE;
229 @@ -402,7 +398,7 @@ OM_uint32 gpm_inquire_mechs_for_name(OM_uint32 *minor_status,
233 - for (i = 0; i < global_mechs.info_len; i++) {
234 + for (unsigned i = 0; i < global_mechs.info_len; i++) {
235 ret_maj = gss_test_oid_set_member(&ret_min, name_type,
236 global_mechs.info[i].name_types,
238 @@ -439,7 +435,6 @@ OM_uint32 gpm_inquire_attrs_for_mech(OM_uint32 *minor_status,
245 return GSS_S_CALL_INACCESSIBLE_WRITE;
246 @@ -451,7 +446,7 @@ OM_uint32 gpm_inquire_attrs_for_mech(OM_uint32 *minor_status,
247 return GSS_S_FAILURE;
250 - for (i = 0; i < global_mechs.info_len; i++) {
251 + for (unsigned i = 0; i < global_mechs.info_len; i++) {
252 if (!gpm_equal_oids(global_mechs.info[i].mech, mech)) {
255 @@ -495,7 +490,6 @@ OM_uint32 gpm_inquire_saslname_for_mech(OM_uint32 *minor_status,
262 return GSS_S_CALL_INACCESSIBLE_WRITE;
263 @@ -511,7 +505,7 @@ OM_uint32 gpm_inquire_saslname_for_mech(OM_uint32 *minor_status,
264 return GSS_S_FAILURE;
267 - for (i = 0; i < global_mechs.info_len; i++) {
268 + for (unsigned i = 0; i < global_mechs.info_len; i++) {
269 if (!gpm_equal_oids(global_mechs.info[i].mech, desired_mech)) {
272 @@ -554,7 +548,6 @@ OM_uint32 gpm_display_mech_attr(OM_uint32 *minor_status,
279 return GSS_S_CALL_INACCESSIBLE_WRITE;
280 @@ -570,7 +563,7 @@ OM_uint32 gpm_display_mech_attr(OM_uint32 *minor_status,
281 return GSS_S_FAILURE;
284 - for (i = 0; i < global_mechs.desc_len; i++) {
285 + for (unsigned i = 0; i < global_mechs.desc_len; i++) {
286 if (!gpm_equal_oids(global_mechs.desc[i].attr, mech_attr)) {
289 @@ -614,7 +607,6 @@ OM_uint32 gpm_indicate_mechs_by_attrs(OM_uint32 *minor_status,
296 return GSS_S_CALL_INACCESSIBLE_WRITE;
297 @@ -636,8 +628,9 @@ OM_uint32 gpm_indicate_mechs_by_attrs(OM_uint32 *minor_status,
301 - for (i = 0; i < global_mechs.info_len; i++) {
302 + for (unsigned i = 0; i < global_mechs.info_len; i++) {
303 if (desired_mech_attrs != GSS_C_NO_OID_SET) {
305 for (j = 0; j < desired_mech_attrs->count; j++) {
306 ret_maj = gss_test_oid_set_member(&ret_min,
307 &desired_mech_attrs->elements[j],
308 @@ -657,6 +650,7 @@ OM_uint32 gpm_indicate_mechs_by_attrs(OM_uint32 *minor_status,
311 if (except_mech_attrs != GSS_C_NO_OID_SET) {
313 for (j = 0; j < except_mech_attrs->count; j++) {
314 ret_maj = gss_test_oid_set_member(&ret_min,
315 &except_mech_attrs->elements[j],
316 @@ -676,6 +670,7 @@ OM_uint32 gpm_indicate_mechs_by_attrs(OM_uint32 *minor_status,
319 if (critical_mech_attrs != GSS_C_NO_OID_SET) {
321 for (j = 0; j < critical_mech_attrs->count; j++) {
322 ret_maj = gss_test_oid_set_member(&ret_min,
323 &critical_mech_attrs->elements[j],
324 diff --git a/proxy/src/gp_common.h b/proxy/src/gp_common.h
325 index edc23b4..4f76e58 100644
326 --- a/proxy/src/gp_common.h
327 +++ b/proxy/src/gp_common.h
328 @@ -104,9 +104,8 @@ union gp_rpc_res {
329 #define gp_options_find(res, opts, name, len) \
331 struct gssx_option *_v; \
334 - for (_o = 0; _o < opts.options_len; _o++) { \
335 + for (unsigned _o = 0; _o < opts.options_len; _o++) { \
336 _v = &opts.options_val[_o]; \
337 if (gp_option_name_match(_v, name, len)) { \
339 diff --git a/proxy/src/gp_config.c b/proxy/src/gp_config.c
340 index 5c1ca02..a671333 100644
341 --- a/proxy/src/gp_config.c
342 +++ b/proxy/src/gp_config.c
343 @@ -57,11 +57,9 @@ static void free_str_array(const char ***a, int *count)
345 void free_cred_store_elements(gss_key_value_set_desc *cs)
349 if (!cs->elements) return;
351 - for (i = 0; i < cs->count; i++) {
352 + for (unsigned i = 0; i < cs->count; i++) {
353 safefree(cs->elements[i].key);
354 safefree(cs->elements[i].value);
356 @@ -146,7 +144,7 @@ static int get_krb5_mech_cfg(struct gp_service *svc,
364 svc->krb5.store.elements =
365 @@ -698,7 +696,6 @@ struct gp_creds_handle *gp_service_get_creds_handle(struct gp_service *svc)
366 void free_config(struct gp_config **cfg)
368 struct gp_config *config = *cfg;
373 @@ -709,7 +706,7 @@ void free_config(struct gp_config **cfg)
374 free(config->socket_name);
375 free(config->proxy_user);
377 - for (i=0; i < config->num_svcs; i++) {
378 + for (int i = 0; i < config->num_svcs; i++) {
379 gp_service_free(config->svcs[i]);
380 safefree(config->svcs[i]);
382 diff --git a/proxy/src/gp_conv.c b/proxy/src/gp_conv.c
383 index 71d6d9d..b874b06 100644
384 --- a/proxy/src/gp_conv.c
385 +++ b/proxy/src/gp_conv.c
386 @@ -599,7 +599,6 @@ done:
387 int gp_conv_gssx_to_oid_set(gssx_OID_set *in, gss_OID_set *out)
392 if (in->gssx_OID_set_len == 0) {
393 *out = GSS_C_NO_OID_SET;
394 @@ -618,7 +617,7 @@ int gp_conv_gssx_to_oid_set(gssx_OID_set *in, gss_OID_set *out)
398 - for (i = 0; i < o->count; i++) {
399 + for (size_t i = 0; i < o->count; i++) {
400 o->elements[i].elements =
401 gp_memdup(in->gssx_OID_set_val[i].octet_string_val,
402 in->gssx_OID_set_val[i].octet_string_len);
403 @@ -641,7 +640,6 @@ int gp_conv_gssx_to_oid_set(gssx_OID_set *in, gss_OID_set *out)
404 int gp_conv_oid_set_to_gssx(gss_OID_set in, gssx_OID_set *out)
409 if (in->count == 0) {
411 @@ -653,7 +651,7 @@ int gp_conv_oid_set_to_gssx(gss_OID_set in, gssx_OID_set *out)
415 - for (i = 0; i < in->count; i++) {
416 + for (size_t i = 0; i < in->count; i++) {
417 ret = gp_conv_octet_string(in->elements[i].length,
418 in->elements[i].elements,
419 &out->gssx_OID_set_val[i]);
420 diff --git a/proxy/src/gp_creds.c b/proxy/src/gp_creds.c
421 index 6570b06..e05ad01 100644
422 --- a/proxy/src/gp_creds.c
423 +++ b/proxy/src/gp_creds.c
424 @@ -312,7 +312,6 @@ static int gp_get_cred_environment(struct gp_call_ctx *gpcall,
430 memset(cs, 0, sizeof(gss_key_value_set_desc));
432 @@ -419,7 +418,7 @@ static int gp_get_cred_environment(struct gp_call_ctx *gpcall,
436 - for (d = 0; d < svc->krb5.store.count; d++) {
437 + for (unsigned d = 0; d < svc->krb5.store.count; d++) {
438 if (strcmp(svc->krb5.store.elements[d].key, "client_keytab") == 0) {
440 } else if (strcmp(svc->krb5.store.elements[d].key, "keytab") == 0) {
441 diff --git a/proxy/src/gp_export.c b/proxy/src/gp_export.c
442 index 12b8d5f..3a927c9 100644
443 --- a/proxy/src/gp_export.c
444 +++ b/proxy/src/gp_export.c
445 @@ -288,7 +288,6 @@ uint32_t gp_export_gssx_cred(uint32_t *min, struct gp_call_ctx *gpcall,
446 uint32_t acceptor_lifetime = 0;
447 struct gssx_cred_element *el;
450 struct gp_creds_handle *handle = NULL;
451 gss_buffer_desc token = GSS_C_EMPTY_BUFFER;
453 @@ -314,8 +313,7 @@ uint32_t gp_export_gssx_cred(uint32_t *min, struct gp_call_ctx *gpcall,
455 out->elements.elements_len = mechanisms->count;
457 - for (i = 0, j = 0; i < mechanisms->count; i++, j++) {
459 + for (unsigned i = 0, j = 0; i < mechanisms->count; i++, j++) {
460 el = &out->elements.elements_val[j];
462 ret_maj = gss_inquire_cred_by_mech(&ret_min, *in,
463 @@ -399,11 +397,10 @@ static void gp_set_cred_options(gssx_cred *cred, gss_cred_id_t gss_cred)
464 krb5_enctype *ktypes;
465 bool no_ci_flags = false;
469 - for (i = 0; i < cred->elements.elements_len; i++) {
470 + for (unsigned i = 0; i < cred->elements.elements_len; i++) {
471 ce = &cred->elements.elements_val[i];
472 - for (j = 0; j < ce->options.options_len; j++) {
473 + for (unsigned j = 0; j < ce->options.options_len; j++) {
474 op = &ce->options.options_val[j];
475 if ((op->option.octet_string_len ==
476 sizeof(KRB5_SET_ALLOWED_ENCTYPE)) &&
477 diff --git a/proxy/src/gp_rpc_acquire_cred.c b/proxy/src/gp_rpc_acquire_cred.c
478 index e9c7d56..fcb4fbe 100644
479 --- a/proxy/src/gp_rpc_acquire_cred.c
480 +++ b/proxy/src/gp_rpc_acquire_cred.c
481 @@ -20,7 +20,6 @@ int gp_acquire_cred(struct gp_call_ctx *gpcall,
482 gss_cred_id_t *add_out_cred = NULL;
483 int acquire_type = ACQ_NORMAL;
487 aca = &arg->acquire_cred;
488 acr = &res->acquire_cred;
489 @@ -63,7 +62,7 @@ int gp_acquire_cred(struct gp_call_ctx *gpcall,
493 - for (i = 0; i < desired_mechs->count; i++) {
494 + for (unsigned i = 0; i < desired_mechs->count; i++) {
495 desired_mech = &desired_mechs->elements[i];
497 if (!gp_creds_allowed_mech(gpcall, desired_mech)) {
498 @@ -93,7 +92,7 @@ int gp_acquire_cred(struct gp_call_ctx *gpcall,
500 cred_usage = gp_conv_gssx_to_cred_usage(aca->cred_usage);
502 - for (i = 0; i < use_mechs->count; i++) {
503 + for (unsigned i = 0; i < use_mechs->count; i++) {
504 desired_mech = &use_mechs->elements[i];
505 /* this should really be folded into an extended
506 * gss_add_cred in gssapi that can accept a set of URIs
507 diff --git a/proxy/src/gp_rpc_debug.c b/proxy/src/gp_rpc_debug.c
508 index 2e2c050..a814448 100644
509 --- a/proxy/src/gp_rpc_debug.c
510 +++ b/proxy/src/gp_rpc_debug.c
511 @@ -19,7 +19,7 @@ void gpdbg_octet_string(octet_string *x)
513 fprintf(stderr, "... ] ");
515 - for (int i = 0; i < x->octet_string_len; i++) {
516 + for (unsigned i = 0; i < x->octet_string_len; i++) {
517 fprintf(stderr, "%x", x->octet_string_val[i]);
519 fprintf(stderr, " ] ");
520 @@ -55,7 +55,7 @@ void gpdbg_gssx_OID(gssx_OID *x)
521 void gpdbg_gssx_OID_set(gssx_OID_set *x)
523 gp_debug_printf("{ ");
524 - for (int i = 0; i < x->gssx_OID_set_len; i++) {
525 + for (unsigned i = 0; i < x->gssx_OID_set_len; i++) {
526 gpdbg_gssx_OID(&x->gssx_OID_set_val[i]);
528 gp_debug_printf("} ");
529 @@ -90,7 +90,7 @@ void gpdbg_gssx_option(gssx_option *x)
530 #define gpdbg_extensions(x) do { \
531 if ((x)->extensions.extensions_len > 0) { \
532 gp_debug_printf("[ "); \
533 - for (int i = 0; i < (x)->extensions.extensions_len; i++) { \
534 + for (unsigned i = 0; i < (x)->extensions.extensions_len; i++) { \
535 gpdbg_gssx_option(&(x)->extensions.extensions_val[i]); \
537 gp_debug_printf("] "); \
538 @@ -100,7 +100,7 @@ void gpdbg_gssx_option(gssx_option *x)
539 #define gpdbg_options(x) do { \
540 if ((x)->options.options_len > 0) { \
541 gp_debug_printf("[ "); \
542 - for (int i = 0; i < (x)->options.options_len; i++) { \
543 + for (unsigned i = 0; i < (x)->options.options_len; i++) { \
544 gpdbg_gssx_option(&(x)->options.options_val[i]); \
546 gp_debug_printf("] "); \
547 @@ -168,7 +168,7 @@ void gpdbg_gssx_call_ctx(gssx_call_ctx *x)
548 #define gpdbg_name_attributes(X) do { \
549 gp_debug_printf("[ "); \
550 if (x->name_attributes.name_attributes_len > 0) { \
551 - for (int i = 0; i < x->name_attributes.name_attributes_len; i++) { \
552 + for (unsigned i = 0; i < x->name_attributes.name_attributes_len; i++) { \
553 gpdbg_gssx_name_attr( \
554 &x->name_attributes.name_attributes_val[i]); \
556 @@ -209,7 +209,7 @@ void gpdbg_gssx_cred(gssx_cred *x)
557 gp_debug_printf("{ ");
558 gpdbg_gssx_name(&x->desired_name);
559 gp_debug_printf("[ ");
560 - for (int i = 0; i < x->elements.elements_len; i++) {
561 + for (unsigned i = 0; i < x->elements.elements_len; i++) {
562 gpdbg_gssx_cred_element(&x->elements.elements_val[i]);
564 gp_debug_printf("] ");
565 @@ -289,17 +289,17 @@ void gpdbg_gssx_res_indicate_mechs(gssx_res_indicate_mechs *x)
566 gp_debug_printf(" GSSX_RES_INDICATE_MECHS( status: ");
567 gpdbg_gssx_status(&x->status);
568 gp_debug_printf("mechs: [ ");
569 - for (int i = 0; i < x->mechs.mechs_len; i++) {
570 + for (unsigned i = 0; i < x->mechs.mechs_len; i++) {
571 gpdbg_gssx_mech_info(&x->mechs.mechs_val[i]);
573 gp_debug_printf("] ");
574 gp_debug_printf("mech_attr_descs: [ ");
575 - for (int i = 0; i < x->mech_attr_descs.mech_attr_descs_len; i++) {
576 + for (unsigned i = 0; i < x->mech_attr_descs.mech_attr_descs_len; i++) {
577 gpdbg_gssx_mech_attr(&x->mech_attr_descs.mech_attr_descs_val[i]);
579 gp_debug_printf("] ");
580 gp_debug_printf("supported_extensions: [ ");
582 + for (unsigned i = 0;
583 i < x->supported_extensions.supported_extensions_len; i++) {
585 &x->supported_extensions.supported_extensions_val[i]);
586 @@ -602,7 +602,7 @@ void gpdbg_gssx_arg_wrap(gssx_arg_wrap *x)
587 gp_debug_printf("conf_req: ");
588 gp_debug_printf("%d ", (int)x->conf_req);
589 gp_debug_printf("message_buffer: [ ");
590 - for (int i = 0; i < x->message_buffer.message_buffer_len; i++) {
591 + for (unsigned i = 0; i < x->message_buffer.message_buffer_len; i++) {
592 gpdbg_octet_string(&x->message_buffer.message_buffer_val[i]);
594 gp_debug_printf("] ");
595 @@ -618,7 +618,7 @@ void gpdbg_gssx_res_wrap(gssx_res_wrap *x)
596 gp_debug_printf("context_handle: ");
597 GPRPCDEBUG(gssx_ctx, x->context_handle);
598 gp_debug_printf("token_buffer: [ ");
599 - for (int i = 0; i < x->token_buffer.token_buffer_len; i++) {
600 + for (unsigned i = 0; i < x->token_buffer.token_buffer_len; i++) {
601 gpdbg_octet_string(&x->token_buffer.token_buffer_val[i]);
603 gp_debug_printf("] ");
604 @@ -640,7 +640,7 @@ void gpdbg_gssx_arg_unwrap(gssx_arg_unwrap *x)
605 gp_debug_printf("context_handle: ");
606 gpdbg_gssx_ctx(&x->context_handle);
607 gp_debug_printf("token_buffer: [ ");
608 - for (int i = 0; i < x->token_buffer.token_buffer_len; i++) {
609 + for (unsigned i = 0; i < x->token_buffer.token_buffer_len; i++) {
610 gpdbg_octet_string(&x->token_buffer.token_buffer_val[i]);
612 gp_debug_printf("] ");
613 @@ -656,7 +656,7 @@ void gpdbg_gssx_res_unwrap(gssx_res_unwrap *x)
614 gp_debug_printf("context_handle: ");
615 GPRPCDEBUG(gssx_ctx, x->context_handle);
616 gp_debug_printf("message_buffer: [ ");
617 - for (int i = 0; i < x->message_buffer.message_buffer_len; i++) {
618 + for (unsigned i = 0; i < x->message_buffer.message_buffer_len; i++) {
619 gpdbg_octet_string(&x->message_buffer.message_buffer_val[i]);
621 gp_debug_printf("] ");
622 diff --git a/proxy/src/gp_rpc_indicate_mechs.c b/proxy/src/gp_rpc_indicate_mechs.c
623 index 8abbc7f..6ae6756 100644
624 --- a/proxy/src/gp_rpc_indicate_mechs.c
625 +++ b/proxy/src/gp_rpc_indicate_mechs.c
626 @@ -25,8 +25,7 @@ int gp_indicate_mechs(struct gp_call_ctx *gpcall UNUSED,
634 ima = &arg->indicate_mechs;
635 imr = &res->indicate_mechs;
636 @@ -53,8 +52,7 @@ int gp_indicate_mechs(struct gp_call_ctx *gpcall UNUSED,
638 imr->mechs.mechs_len = mech_set->count;
640 - for (i = 0, h = 0; i < mech_set->count; i++, h++) {
642 + for (unsigned i = 0, h = 0; i < mech_set->count; i++, h++) {
643 mi = &imr->mechs.mechs_val[h];
645 ret = gp_conv_oid_to_gssx(&mech_set->elements[i], &mi->mech);
646 @@ -104,8 +102,7 @@ int gp_indicate_mechs(struct gp_call_ctx *gpcall UNUSED,
650 - for (j = 0; j < mech_attrs->count; j++) {
652 + for (unsigned j = 0; j < mech_attrs->count; j++) {
653 ret_maj = gss_test_oid_set_member(&ret_min,
654 &mech_attrs->elements[j],
656 @@ -136,8 +133,7 @@ int gp_indicate_mechs(struct gp_call_ctx *gpcall UNUSED,
660 - for (j = 0; j < known_mech_attrs->count; j++) {
662 + for (unsigned j = 0; j < known_mech_attrs->count; j++) {
663 ret_maj = gss_test_oid_set_member(&ret_min,
664 &known_mech_attrs->elements[j],
666 @@ -205,8 +201,7 @@ int gp_indicate_mechs(struct gp_call_ctx *gpcall UNUSED,
668 imr->mech_attr_descs.mech_attr_descs_len = attr_set->count;
670 - for (i = 0; i < attr_set->count; i++) {
672 + for (unsigned i = 0; i < attr_set->count; i++) {
673 ma = &imr->mech_attr_descs.mech_attr_descs_val[i];
675 ret = gp_conv_oid_to_gssx(&attr_set->elements[i], &ma->attr);
676 diff --git a/proxy/src/gp_socket.c b/proxy/src/gp_socket.c
677 index 829ff21..17ecf7c 100644
678 --- a/proxy/src/gp_socket.c
679 +++ b/proxy/src/gp_socket.c
680 @@ -303,7 +303,7 @@ static void gp_socket_read(verto_ctx *vctx, verto_ev *ev)
681 struct gp_buffer *rbuf;
689 @@ -487,7 +487,7 @@ static void gp_socket_write(verto_ctx *vctx, verto_ev *ev)
693 - if (wn < sizeof(size)) {
694 + if (wn < (ssize_t) sizeof(size)) {
695 /* don't bother trying to handle sockets that can't
696 * buffer even 4 bytes */
697 gp_conn_free(wbuf->conn);
698 diff --git a/proxy/src/gp_util.c b/proxy/src/gp_util.c
699 index ca83eb3..f158b84 100644
700 --- a/proxy/src/gp_util.c
701 +++ b/proxy/src/gp_util.c
702 @@ -109,7 +109,7 @@ char *gp_strerror(int errnum)
703 ssize_t gp_safe_read(int fd, void *buf, size_t count)
705 char *b = (char *)buf;
711 @@ -128,7 +128,7 @@ ssize_t gp_safe_read(int fd, void *buf, size_t count)
712 ssize_t gp_safe_write(int fd, const void *buf, size_t count)
714 const char *b = (const char *)buf;
720 diff --git a/proxy/tests/t_utils.c b/proxy/tests/t_utils.c
721 index 6af9a16..36f7bd1 100644
722 --- a/proxy/tests/t_utils.c
723 +++ b/proxy/tests/t_utils.c
725 int t_send_buffer(int fd, char *buf, uint32_t len)
733 @@ -36,7 +36,7 @@ int t_send_buffer(int fd, char *buf, uint32_t len)
734 int t_recv_buffer(int fd, char *buf, uint32_t *len)
741 rn = read(fd, &size, sizeof(uint32_t));