This is an automated email from the git hooks/post-receive script.
rharwood pushed a change to branch master in repository gssproxy.
from eada55e Allow connection to self when impersonator set new 9bdb462 Turn on -Wextra new e72d1fa Fix unused variables new eb39b7c Fix mismatched sign comparisons new 10e0a86 Fix error checking on get_impersonator_fallback() new b50a863 Remove gpm_release_ctx() to fix double unlock
The 5 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference.
Summary of changes: proxy/Makefile.am | 2 +- proxy/src/client/gpm_acquire_cred.c | 11 +++------- proxy/src/client/gpm_common.c | 11 +++------- proxy/src/client/gpm_display_status.c | 2 +- proxy/src/client/gpm_import_and_canon_name.c | 7 +++--- proxy/src/client/gpm_indicate_mechs.c | 33 ++++++++++++---------------- proxy/src/client/gpm_release_handle.c | 2 +- proxy/src/gp_common.h | 4 ++-- proxy/src/gp_config.c | 17 +++++--------- proxy/src/gp_conv.c | 10 ++++----- proxy/src/gp_conv.h | 3 +-- proxy/src/gp_creds.c | 12 +++++----- proxy/src/gp_export.c | 9 +++----- proxy/src/gp_init.c | 2 +- proxy/src/gp_rpc_accept_sec_context.c | 3 +-- proxy/src/gp_rpc_acquire_cred.c | 8 +++---- proxy/src/gp_rpc_debug.c | 26 +++++++++++----------- proxy/src/gp_rpc_get_mic.c | 4 ++-- proxy/src/gp_rpc_import_and_canon_name.c | 5 ++--- proxy/src/gp_rpc_indicate_mechs.c | 20 ++++++----------- proxy/src/gp_rpc_init_sec_context.c | 3 +-- proxy/src/gp_rpc_process.c | 21 ++++-------------- proxy/src/gp_rpc_process.h | 6 +++++ proxy/src/gp_rpc_release_handle.c | 5 ++--- proxy/src/gp_rpc_unwrap.c | 5 ++--- proxy/src/gp_rpc_verify_mic.c | 5 ++--- proxy/src/gp_rpc_wrap.c | 4 ++-- proxy/src/gp_rpc_wrap_size_limit.c | 5 ++--- proxy/src/gp_socket.c | 6 ++--- proxy/src/gp_util.c | 4 ++-- proxy/src/gssproxy.c | 2 +- proxy/tests/t_utils.c | 4 ++-- 32 files changed, 104 insertions(+), 157 deletions(-)
This is an automated email from the git hooks/post-receive script.
rharwood pushed a commit to branch master in repository gssproxy.
commit 9bdb4626583113f03bb97324895a25561d9fc352 Author: Robbie Harwood rharwood@redhat.com Date: Wed Mar 15 13:28:26 2017 -0400
Turn on -Wextra
Signed-off-by: Robbie Harwood rharwood@redhat.com Reviewed-by: Simo Sorce simo@redhat.com Merges: #173 --- proxy/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/proxy/Makefile.am b/proxy/Makefile.am index e1fbac1..5cd2255 100644 --- a/proxy/Makefile.am +++ b/proxy/Makefile.am @@ -44,7 +44,7 @@ AM_CFLAGS += -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith \ -Wcast-qual -Wcast-align -Wwrite-strings \ -fstrict-aliasing -Wstrict-aliasing -Werror=strict-aliasing \ -Werror-implicit-function-declaration \ - -Werror=format-security + -Werror=format-security -Wextra if BUILD_HARDENING AM_CPPFLAGS += -D_FORTIFY_SOURCE=2 -Wdate-time AM_CFLAGS += -fPIE -fstack-protector-strong
This is an automated email from the git hooks/post-receive script.
rharwood pushed a commit to branch master in repository gssproxy.
commit e72d1fa53df8af55b47639ed01f9f0bafa7a2ca8 Author: Robbie Harwood rharwood@redhat.com Date: Wed Mar 15 13:52:36 2017 -0400
Fix unused variables
Signed-off-by: Robbie Harwood rharwood@redhat.com Reviewed-by: Simo Sorce simo@redhat.com Merges: #173 --- proxy/src/client/gpm_common.c | 1 + proxy/src/client/gpm_display_status.c | 2 +- proxy/src/client/gpm_release_handle.c | 2 +- proxy/src/gp_common.h | 1 + proxy/src/gp_config.c | 8 ++------ proxy/src/gp_conv.c | 4 ++-- proxy/src/gp_conv.h | 3 +-- proxy/src/gp_creds.c | 7 +++---- proxy/src/gp_init.c | 2 +- proxy/src/gp_rpc_accept_sec_context.c | 3 +-- proxy/src/gp_rpc_acquire_cred.c | 3 +-- proxy/src/gp_rpc_get_mic.c | 4 ++-- proxy/src/gp_rpc_import_and_canon_name.c | 5 ++--- proxy/src/gp_rpc_indicate_mechs.c | 5 ++--- proxy/src/gp_rpc_init_sec_context.c | 3 +-- proxy/src/gp_rpc_process.c | 21 ++++----------------- proxy/src/gp_rpc_process.h | 6 ++++++ proxy/src/gp_rpc_release_handle.c | 5 ++--- proxy/src/gp_rpc_unwrap.c | 5 ++--- proxy/src/gp_rpc_verify_mic.c | 5 ++--- proxy/src/gp_rpc_wrap.c | 4 ++-- proxy/src/gp_rpc_wrap_size_limit.c | 5 ++--- proxy/src/gp_socket.c | 2 +- proxy/src/gssproxy.c | 2 +- 24 files changed, 44 insertions(+), 64 deletions(-)
diff --git a/proxy/src/client/gpm_common.c b/proxy/src/client/gpm_common.c index 0a54dbc..030765a 100644 --- a/proxy/src/client/gpm_common.c +++ b/proxy/src/client/gpm_common.c @@ -320,6 +320,7 @@ static void gpm_release_ctx(struct gpm_ctx *gpmctx) OM_uint32 gpm_release_buffer(OM_uint32 *minor_status, gss_buffer_t buffer) { + *minor_status = 0; if (buffer != GSS_C_NO_BUFFER) { if (buffer->value) { free(buffer->value); diff --git a/proxy/src/client/gpm_display_status.c b/proxy/src/client/gpm_display_status.c index 1f8d755..bbb546f 100644 --- a/proxy/src/client/gpm_display_status.c +++ b/proxy/src/client/gpm_display_status.c @@ -43,7 +43,7 @@ void gpm_save_internal_status(uint32_t err, char *err_str) OM_uint32 gpm_display_status(OM_uint32 *minor_status, OM_uint32 status_value, int status_type, - const gss_OID mech_type, + const gss_OID mech_type UNUSED, OM_uint32 *message_context, gss_buffer_t status_string) { diff --git a/proxy/src/client/gpm_release_handle.c b/proxy/src/client/gpm_release_handle.c index 7a6aaed..8f49ee9 100644 --- a/proxy/src/client/gpm_release_handle.c +++ b/proxy/src/client/gpm_release_handle.c @@ -58,7 +58,7 @@ done:
OM_uint32 gpm_delete_sec_context(OM_uint32 *minor_status, gssx_ctx **context_handle, - gss_buffer_t output_token) + gss_buffer_t output_token UNUSED) { union gp_rpc_arg uarg; union gp_rpc_res ures; diff --git a/proxy/src/gp_common.h b/proxy/src/gp_common.h index 36fd843..edc23b4 100644 --- a/proxy/src/gp_common.h +++ b/proxy/src/gp_common.h @@ -8,6 +8,7 @@ #include "gp_log.h"
#define no_const(ptr) ((void *)((uintptr_t)(ptr))) +#define UNUSED __attribute__((unused))
/* add element to list head */ #define LIST_ADD(list, elem) do { \ diff --git a/proxy/src/gp_config.c b/proxy/src/gp_config.c index 1b833fd..5c1ca02 100644 --- a/proxy/src/gp_config.c +++ b/proxy/src/gp_config.c @@ -720,7 +720,6 @@ void free_config(struct gp_config **cfg) }
static int gp_config_from_file(const char *config_file, - struct gp_ini_context *ctx, struct ini_cfgobj *ini_config, const uint32_t collision_flags) { @@ -764,7 +763,6 @@ static int gp_config_from_file(const char *config_file, }
static int gp_config_from_dir(const char *config_dir, - struct gp_ini_context *ctx, struct ini_cfgobj **ini_config, const uint32_t collision_flags) { @@ -847,8 +845,7 @@ int gp_config_init(const char *config_file, const char *config_dir, }
if (config_file) { - ret = gp_config_from_file(config_file, ctx, ini_config, - collision_flags); + ret = gp_config_from_file(config_file, ini_config, collision_flags); if (ret == ENOENT) { GPDEBUG("Expected config file %s but did not find it.\n", config_file); @@ -857,8 +854,7 @@ int gp_config_init(const char *config_file, const char *config_dir, } } if (config_dir) { - ret = gp_config_from_dir(config_dir, ctx, &ini_config, - collision_flags); + ret = gp_config_from_dir(config_dir, &ini_config, collision_flags); if (ret) { return ret; } diff --git a/proxy/src/gp_conv.c b/proxy/src/gp_conv.c index 6aa66a8..71d6d9d 100644 --- a/proxy/src/gp_conv.c +++ b/proxy/src/gp_conv.c @@ -6,6 +6,7 @@ #include <stdbool.h> #include <errno.h> #include "gp_conv.h" +#include "src/gp_common.h"
void *gp_memdup(void *in, size_t len) { @@ -488,8 +489,7 @@ done: return ret_maj; }
-int gp_conv_status_to_gssx(struct gssx_call_ctx *call_ctx, - uint32_t ret_maj, uint32_t ret_min, +int gp_conv_status_to_gssx(uint32_t ret_maj, uint32_t ret_min, gss_OID mech, struct gssx_status *status) { int ret; diff --git a/proxy/src/gp_conv.h b/proxy/src/gp_conv.h index e247dbd..699b301 100644 --- a/proxy/src/gp_conv.h +++ b/proxy/src/gp_conv.h @@ -39,8 +39,7 @@ uint32_t gp_conv_name_to_gssx_alloc(uint32_t *min, gss_name_t in, gssx_name **out); uint32_t gp_conv_gssx_to_name(uint32_t *min, gssx_name *in, gss_name_t *out);
-int gp_conv_status_to_gssx(struct gssx_call_ctx *call_ctx, - uint32_t ret_maj, uint32_t ret_min, +int gp_conv_status_to_gssx(uint32_t ret_maj, uint32_t ret_min, gss_OID mech, struct gssx_status *status);
int gp_copy_utf8string(utf8string *in, utf8string *out); diff --git a/proxy/src/gp_creds.c b/proxy/src/gp_creds.c index 7d89b06..6570b06 100644 --- a/proxy/src/gp_creds.c +++ b/proxy/src/gp_creds.c @@ -252,7 +252,6 @@ done:
static int ensure_segregated_ccache(struct gp_call_ctx *gpcall, int cc_num, - struct gp_service *svc, gss_key_value_set_desc *cs) { int ret; @@ -482,7 +481,7 @@ static int gp_get_cred_environment(struct gp_call_ctx *gpcall, } }
- ret = ensure_segregated_ccache(gpcall, cc_num, svc, cs); + ret = ensure_segregated_ccache(gpcall, cc_num, cs); if (ret != 0) { goto done; } @@ -587,8 +586,8 @@ uint32_t gp_add_krb5_creds(uint32_t *min, gss_cred_id_t in_cred, gssx_name *desired_name, gss_cred_usage_t cred_usage, - uint32_t initiator_time_req, - uint32_t acceptor_time_req, + uint32_t initiator_time_req UNUSED, + uint32_t acceptor_time_req UNUSED, gss_cred_id_t *output_cred_handle, gss_OID_set *actual_mechs, uint32_t *initiator_time_rec, diff --git a/proxy/src/gp_init.c b/proxy/src/gp_init.c index bb7ba6b..4673f02 100644 --- a/proxy/src/gp_init.c +++ b/proxy/src/gp_init.c @@ -96,7 +96,7 @@ void fini_server(void) closelog(); }
-static void break_loop(verto_ctx *vctx, verto_ev *ev) +static void break_loop(verto_ctx *vctx, verto_ev *ev UNUSED) { GPDEBUG("Exiting after receiving a signal\n"); verto_break(vctx); diff --git a/proxy/src/gp_rpc_accept_sec_context.c b/proxy/src/gp_rpc_accept_sec_context.c index 22a4cf7..ae4de55 100644 --- a/proxy/src/gp_rpc_accept_sec_context.c +++ b/proxy/src/gp_rpc_accept_sec_context.c @@ -152,8 +152,7 @@ done: ret_maj = acpt_maj; ret_min = acpt_min; } - ret = gp_conv_status_to_gssx(&asca->call_ctx, - ret_maj, ret_min, oid, + ret = gp_conv_status_to_gssx(ret_maj, ret_min, oid, &ascr->status); GPRPCDEBUG(gssx_res_accept_sec_context, ascr);
diff --git a/proxy/src/gp_rpc_acquire_cred.c b/proxy/src/gp_rpc_acquire_cred.c index 9a55937..e9c7d56 100644 --- a/proxy/src/gp_rpc_acquire_cred.c +++ b/proxy/src/gp_rpc_acquire_cred.c @@ -150,8 +150,7 @@ int gp_acquire_cred(struct gp_call_ctx *gpcall, }
done: - ret = gp_conv_status_to_gssx(&aca->call_ctx, - ret_maj, ret_min, desired_mech, + ret = gp_conv_status_to_gssx(ret_maj, ret_min, desired_mech, &acr->status);
GPRPCDEBUG(gssx_res_acquire_cred, acr); diff --git a/proxy/src/gp_rpc_get_mic.c b/proxy/src/gp_rpc_get_mic.c index 1d9a1fe..dfba77e 100644 --- a/proxy/src/gp_rpc_get_mic.c +++ b/proxy/src/gp_rpc_get_mic.c @@ -3,7 +3,7 @@ #include "gp_rpc_process.h" #include <gssapi/gssapi.h>
-int gp_get_mic(struct gp_call_ctx *gpcall, +int gp_get_mic(struct gp_call_ctx *gpcall UNUSED, union gp_rpc_arg *arg, union gp_rpc_res *res) { @@ -79,7 +79,7 @@ int gp_get_mic(struct gp_call_ctx *gpcall, ret_min = 0;
done: - ret = gp_conv_status_to_gssx(&gma->call_ctx, ret_maj, ret_min, + ret = gp_conv_status_to_gssx(ret_maj, ret_min, GSS_C_NO_OID, &gmr->status); GPRPCDEBUG(gssx_res_get_mic, gmr); gss_release_buffer(&ret_min, &message_token); diff --git a/proxy/src/gp_rpc_import_and_canon_name.c b/proxy/src/gp_rpc_import_and_canon_name.c index 3d67f40..e7b8e63 100644 --- a/proxy/src/gp_rpc_import_and_canon_name.c +++ b/proxy/src/gp_rpc_import_and_canon_name.c @@ -8,7 +8,7 @@ * I am not kidding, if you hav not read it, go back and do it now, or do not * touch this function */
-int gp_import_and_canon_name(struct gp_call_ctx *gpcall, +int gp_import_and_canon_name(struct gp_call_ctx *gpcall UNUSED, union gp_rpc_arg *arg, union gp_rpc_res *res) { @@ -64,8 +64,7 @@ int gp_import_and_canon_name(struct gp_call_ctx *gpcall, /* TODO: icna->name_attributes */
done: - ret = gp_conv_status_to_gssx(&icna->call_ctx, - ret_maj, ret_min, mech, + ret = gp_conv_status_to_gssx(ret_maj, ret_min, mech, &icnr->status); GPRPCDEBUG(gssx_res_import_and_canon_name, icnr);
diff --git a/proxy/src/gp_rpc_indicate_mechs.c b/proxy/src/gp_rpc_indicate_mechs.c index c24b926..8abbc7f 100644 --- a/proxy/src/gp_rpc_indicate_mechs.c +++ b/proxy/src/gp_rpc_indicate_mechs.c @@ -3,7 +3,7 @@ #include "gp_rpc_process.h" #include "gp_debug.h"
-int gp_indicate_mechs(struct gp_call_ctx *gpcall, +int gp_indicate_mechs(struct gp_call_ctx *gpcall UNUSED, union gp_rpc_arg *arg, union gp_rpc_res *res) { @@ -251,8 +251,7 @@ int gp_indicate_mechs(struct gp_call_ctx *gpcall, }
done: - ret = gp_conv_status_to_gssx(&ima->call_ctx, - ret_maj, ret_min, GSS_C_NO_OID, + ret = gp_conv_status_to_gssx(ret_maj, ret_min, GSS_C_NO_OID, &imr->status); GPRPCDEBUG(gssx_res_indicate_mechs, imr);
diff --git a/proxy/src/gp_rpc_init_sec_context.c b/proxy/src/gp_rpc_init_sec_context.c index 413e2ec..e4af495 100644 --- a/proxy/src/gp_rpc_init_sec_context.c +++ b/proxy/src/gp_rpc_init_sec_context.c @@ -187,8 +187,7 @@ done: ret_maj = init_maj; ret_min = init_min; } - ret = gp_conv_status_to_gssx(&isca->call_ctx, - ret_maj, ret_min, mech_type, + ret = gp_conv_status_to_gssx(ret_maj, ret_min, mech_type, &iscr->status);
GPRPCDEBUG(gssx_res_init_sec_context, iscr); diff --git a/proxy/src/gp_rpc_process.c b/proxy/src/gp_rpc_process.c index d1a0232..0ea17f0 100644 --- a/proxy/src/gp_rpc_process.c +++ b/proxy/src/gp_rpc_process.c @@ -396,20 +396,7 @@ int gp_rpc_process_call(struct gp_call_ctx *gpcall, return ret; }
-int gp_get_call_context(gp_exec_std_args) -{ - return 0; -} -int gp_export_cred(gp_exec_std_args) -{ - return 0; -} -int gp_import_cred(gp_exec_std_args) -{ - return 0; -} - -int gp_store_cred(gp_exec_std_args) -{ - return 0; -} +GP_EXEC_UNUSED_FUNC(gp_get_call_context); +GP_EXEC_UNUSED_FUNC(gp_export_cred); +GP_EXEC_UNUSED_FUNC(gp_import_cred); +GP_EXEC_UNUSED_FUNC(gp_store_cred); diff --git a/proxy/src/gp_rpc_process.h b/proxy/src/gp_rpc_process.h index eb02c95..da27795 100644 --- a/proxy/src/gp_rpc_process.h +++ b/proxy/src/gp_rpc_process.h @@ -24,6 +24,12 @@ struct gp_service; union gp_rpc_arg *arg, \ union gp_rpc_res *res
+#define GP_EXEC_UNUSED_FUNC(name) \ + int name(struct gp_call_ctx *gpcall UNUSED, \ + union gp_rpc_arg *arg UNUSED, \ + union gp_rpc_res *res UNUSED) \ + { return 0; } + int gp_indicate_mechs(gp_exec_std_args); int gp_get_call_context(gp_exec_std_args); int gp_import_and_canon_name(gp_exec_std_args); diff --git a/proxy/src/gp_rpc_release_handle.c b/proxy/src/gp_rpc_release_handle.c index 4ffdfb9..c8ba8f2 100644 --- a/proxy/src/gp_rpc_release_handle.c +++ b/proxy/src/gp_rpc_release_handle.c @@ -2,7 +2,7 @@
#include "gp_rpc_process.h"
-int gp_release_handle(struct gp_call_ctx *gpcall, +int gp_release_handle(struct gp_call_ctx *gpcall UNUSED, union gp_rpc_arg *arg, union gp_rpc_res *res) { @@ -35,8 +35,7 @@ int gp_release_handle(struct gp_call_ctx *gpcall, break; }
- ret = gp_conv_status_to_gssx(&rha->call_ctx, - ret_maj, ret_min, GSS_C_NO_OID, + ret = gp_conv_status_to_gssx(ret_maj, ret_min, GSS_C_NO_OID, &rhr->status); GPRPCDEBUG(gssx_res_release_handle, rhr);
diff --git a/proxy/src/gp_rpc_unwrap.c b/proxy/src/gp_rpc_unwrap.c index bc052cb..fad8cfe 100644 --- a/proxy/src/gp_rpc_unwrap.c +++ b/proxy/src/gp_rpc_unwrap.c @@ -3,7 +3,7 @@ #include "gp_rpc_process.h" #include <gssapi/gssapi.h>
-int gp_unwrap(struct gp_call_ctx *gpcall, +int gp_unwrap(struct gp_call_ctx *gpcall UNUSED, union gp_rpc_arg *arg, union gp_rpc_res *res) { @@ -106,8 +106,7 @@ int gp_unwrap(struct gp_call_ctx *gpcall, ret_min = 0;
done: - ret = gp_conv_status_to_gssx(&uwa->call_ctx, - ret_maj, ret_min, + ret = gp_conv_status_to_gssx(ret_maj, ret_min, GSS_C_NO_OID, &uwr->status); GPRPCDEBUG(gssx_res_unwrap, uwr); diff --git a/proxy/src/gp_rpc_verify_mic.c b/proxy/src/gp_rpc_verify_mic.c index d2920d2..6da6dac 100644 --- a/proxy/src/gp_rpc_verify_mic.c +++ b/proxy/src/gp_rpc_verify_mic.c @@ -3,7 +3,7 @@ #include "gp_rpc_process.h" #include <gssapi/gssapi.h>
-int gp_verify_mic(struct gp_call_ctx *gpcall, +int gp_verify_mic(struct gp_call_ctx *gpcall UNUSED, union gp_rpc_arg *arg, union gp_rpc_res *res) { @@ -74,8 +74,7 @@ int gp_verify_mic(struct gp_call_ctx *gpcall, ret_min = 0;
done: - ret = gp_conv_status_to_gssx(&vma->call_ctx, - ret_maj, ret_min, + ret = gp_conv_status_to_gssx(ret_maj, ret_min, GSS_C_NO_OID, &vmr->status); GPRPCDEBUG(gssx_res_verify_mic, vmr); diff --git a/proxy/src/gp_rpc_wrap.c b/proxy/src/gp_rpc_wrap.c index d5c950e..ae20bdb 100644 --- a/proxy/src/gp_rpc_wrap.c +++ b/proxy/src/gp_rpc_wrap.c @@ -3,7 +3,7 @@ #include "gp_rpc_process.h" #include <gssapi/gssapi.h>
-int gp_wrap(struct gp_call_ctx *gpcall, +int gp_wrap(struct gp_call_ctx *gpcall UNUSED, union gp_rpc_arg *arg, union gp_rpc_res *res) { @@ -105,7 +105,7 @@ int gp_wrap(struct gp_call_ctx *gpcall, ret_min = 0;
done: - ret = gp_conv_status_to_gssx(&wa->call_ctx, ret_maj, ret_min, + ret = gp_conv_status_to_gssx(ret_maj, ret_min, GSS_C_NO_OID, &wr->status); GPRPCDEBUG(gssx_res_wrap, wr); gss_release_buffer(&ret_min, &output_message_buffer); diff --git a/proxy/src/gp_rpc_wrap_size_limit.c b/proxy/src/gp_rpc_wrap_size_limit.c index 355113c..cab6826 100644 --- a/proxy/src/gp_rpc_wrap_size_limit.c +++ b/proxy/src/gp_rpc_wrap_size_limit.c @@ -3,7 +3,7 @@ #include "gp_rpc_process.h" #include <gssapi/gssapi.h>
-int gp_wrap_size_limit(struct gp_call_ctx *gpcall, +int gp_wrap_size_limit(struct gp_call_ctx *gpcall UNUSED, union gp_rpc_arg *arg, union gp_rpc_res *res) { @@ -51,8 +51,7 @@ int gp_wrap_size_limit(struct gp_call_ctx *gpcall, ret_min = 0;
done: - ret = gp_conv_status_to_gssx(&wsla->call_ctx, - ret_maj, ret_min, + ret = gp_conv_status_to_gssx(ret_maj, ret_min, GSS_C_NO_OID, &wslr->status); GPRPCDEBUG(gssx_res_wrap_size_limit, wslr); diff --git a/proxy/src/gp_socket.c b/proxy/src/gp_socket.c index 62d7dbc..829ff21 100644 --- a/proxy/src/gp_socket.c +++ b/proxy/src/gp_socket.c @@ -146,7 +146,7 @@ static int set_fd_flags(int fd, int flags) return 0; }
-void free_unix_socket(verto_ctx *ctx, verto_ev *ev) +void free_unix_socket(verto_ctx *ctx UNUSED, verto_ev *ev) { struct gp_sock_ctx *sock_ctx = NULL; sock_ctx = verto_get_private(ev); diff --git a/proxy/src/gssproxy.c b/proxy/src/gssproxy.c index 561188e..a020218 100644 --- a/proxy/src/gssproxy.c +++ b/proxy/src/gssproxy.c @@ -119,7 +119,7 @@ static int init_sockets(verto_ctx *vctx, struct gp_config *old_config) return 0; }
-static void hup_handler(verto_ctx *vctx, verto_ev *ev) +static void hup_handler(verto_ctx *vctx, verto_ev *ev UNUSED) { int ret; struct gp_config *new_config, *old_config;
This is an automated email from the git hooks/post-receive script.
rharwood pushed a commit to branch master in repository gssproxy.
commit eb39b7c662f8a18cfedbf8d22440bd588499daf2 Author: Robbie Harwood rharwood@redhat.com Date: Wed Mar 15 14:52:08 2017 -0400
Fix mismatched sign comparisons
We are c99, so also migrate to `for`-loop initializers where possible for clarity.
Signed-off-by: Robbie Harwood rharwood@redhat.com Reviewed-by: Simo Sorce simo@redhat.com Merges: #173 --- proxy/src/client/gpm_acquire_cred.c | 11 +++------- proxy/src/client/gpm_common.c | 4 ++-- proxy/src/client/gpm_import_and_canon_name.c | 7 +++--- proxy/src/client/gpm_indicate_mechs.c | 33 ++++++++++++---------------- proxy/src/gp_common.h | 3 +-- proxy/src/gp_config.c | 9 +++----- proxy/src/gp_conv.c | 6 ++--- proxy/src/gp_creds.c | 3 +-- proxy/src/gp_export.c | 9 +++----- proxy/src/gp_rpc_acquire_cred.c | 5 ++--- proxy/src/gp_rpc_debug.c | 26 +++++++++++----------- proxy/src/gp_rpc_indicate_mechs.c | 15 +++++-------- proxy/src/gp_socket.c | 4 ++-- proxy/src/gp_util.c | 4 ++-- proxy/tests/t_utils.c | 4 ++-- 15 files changed, 58 insertions(+), 85 deletions(-)
diff --git a/proxy/src/client/gpm_acquire_cred.c b/proxy/src/client/gpm_acquire_cred.c index 632973d..8e30e1d 100644 --- a/proxy/src/client/gpm_acquire_cred.c +++ b/proxy/src/client/gpm_acquire_cred.c @@ -6,8 +6,6 @@ static int gpmint_cred_to_actual_mechs(gssx_cred *c, gss_OID_set *a) { gssx_cred_element *e; gss_OID_set m = GSS_C_NO_OID_SET; - int i; -
if (c->elements.elements_len) {
@@ -22,7 +20,7 @@ static int gpmint_cred_to_actual_mechs(gssx_cred *c, gss_OID_set *a) return ENOMEM; }
- for (i = 0; i < c->elements.elements_len; i++) { + for (unsigned i = 0; i < c->elements.elements_len; i++) { e = &c->elements.elements_val[i];
m->elements[i].elements = gp_memdup(e->mech.octet_string_val, @@ -280,7 +278,6 @@ OM_uint32 gpm_inquire_cred(OM_uint32 *minor_status, uint32_t ret_maj = GSS_S_COMPLETE; uint32_t life; int cu; - int i;
if (!cred) { *minor_status = 0; @@ -308,8 +305,7 @@ OM_uint32 gpm_inquire_cred(OM_uint32 *minor_status, life = GSS_C_INDEFINITE; cu = -1;
- for (i = 0; i < cred->elements.elements_len; i++) { - + for (unsigned i = 0; i < cred->elements.elements_len; i++) { e = &cred->elements.elements_val[i];
switch (e->cred_usage) { @@ -402,7 +398,7 @@ OM_uint32 gpm_inquire_cred_by_mech(OM_uint32 *minor_status, gss_OID_desc tmp_oid; uint32_t ret_min = 0; uint32_t ret_maj = GSS_S_COMPLETE; - int i; + unsigned i;
if (!cred) { *minor_status = 0; @@ -414,7 +410,6 @@ OM_uint32 gpm_inquire_cred_by_mech(OM_uint32 *minor_status, }
for (i = 0; i < cred->elements.elements_len; i++) { - e = &cred->elements.elements_val[i]; gp_conv_gssx_to_oid(&e->mech, &tmp_oid); if (!gss_oid_equal(&tmp_oid, mech_type)) { diff --git a/proxy/src/client/gpm_common.c b/proxy/src/client/gpm_common.c index 030765a..8c96986 100644 --- a/proxy/src/client/gpm_common.c +++ b/proxy/src/client/gpm_common.c @@ -166,7 +166,7 @@ static int gpm_send_buffer(struct gpm_ctx *gpmctx, char *buffer, uint32_t length) { uint32_t size; - size_t wn; + ssize_t wn; size_t pos; bool retry; int ret; @@ -232,7 +232,7 @@ static int gpm_recv_buffer(struct gpm_ctx *gpmctx, char *buffer, uint32_t *length) { uint32_t size; - size_t rn; + ssize_t rn; size_t pos; int ret;
diff --git a/proxy/src/client/gpm_import_and_canon_name.c b/proxy/src/client/gpm_import_and_canon_name.c index 83d0736..70149a3 100644 --- a/proxy/src/client/gpm_import_and_canon_name.c +++ b/proxy/src/client/gpm_import_and_canon_name.c @@ -275,7 +275,6 @@ OM_uint32 gpm_inquire_name(OM_uint32 *minor_status, { gss_buffer_set_t xattrs = GSS_C_NO_BUFFER_SET; int ret; - int i;
*minor_status = 0;
@@ -306,13 +305,13 @@ OM_uint32 gpm_inquire_name(OM_uint32 *minor_status, *minor_status = ENOMEM; return GSS_S_FAILURE; } - for (i = 0; i < xattrs->count; i++) { + for (unsigned i = 0; i < xattrs->count; i++) { ret = gp_copy_gssx_to_buffer( &name->name_attributes.name_attributes_val[i].attr, &xattrs->elements[i]); if (ret) { - for (--i; i >= 0; i--) { - free(xattrs->elements[i].value); + for (; i > 0; i--) { + free(xattrs->elements[i-1].value); } free(xattrs->elements); free(xattrs); diff --git a/proxy/src/client/gpm_indicate_mechs.c b/proxy/src/client/gpm_indicate_mechs.c index d4df923..b019a96 100644 --- a/proxy/src/client/gpm_indicate_mechs.c +++ b/proxy/src/client/gpm_indicate_mechs.c @@ -51,7 +51,6 @@ static uint32_t gpm_copy_gss_OID_set(uint32_t *minor_status, gss_OID_set n; uint32_t ret_maj; uint32_t ret_min; - int i;
ret_maj = gss_create_empty_oid_set(&ret_min, &n); if (ret_maj) { @@ -59,7 +58,7 @@ static uint32_t gpm_copy_gss_OID_set(uint32_t *minor_status, return ret_maj; }
- for (i = 0; i < oldset->count; i++) { + for (size_t i = 0; i < oldset->count; i++) { ret_maj = gss_add_oid_set_member(&ret_min, &oldset->elements[i], &n); if (ret_maj) { *minor_status = ret_min; @@ -124,7 +123,6 @@ static void gpmint_indicate_mechs(void) uint32_t ret_min; uint32_t ret_maj = 0; int ret = 0; - int i;
memset(arg, 0, sizeof(gssx_arg_indicate_mechs)); memset(res, 0, sizeof(gssx_res_indicate_mechs)); @@ -158,7 +156,7 @@ static void gpmint_indicate_mechs(void) goto done; }
- for (i = 0; i < res->mechs.mechs_len; i++) { + for (unsigned i = 0; i < res->mechs.mechs_len; i++) { mi = &res->mechs.mechs_val[i]; gi = &global_mechs.info[i];
@@ -222,7 +220,7 @@ static void gpmint_indicate_mechs(void) goto done; }
- for (i = 0; i < res->mech_attr_descs.mech_attr_descs_len; i++) { + for (unsigned i = 0; i < res->mech_attr_descs.mech_attr_descs_len; i++) { ma = &res->mech_attr_descs.mech_attr_descs_val[i]; ga = &global_mechs.desc[i];
@@ -249,7 +247,7 @@ static void gpmint_indicate_mechs(void)
done: if (ret || ret_maj) { - for (i = 0; i < global_mechs.desc_len; i++) { + for (unsigned i = 0; i < global_mechs.desc_len; i++) { ga = &global_mechs.desc[i]; gss_release_oid(&discard, &ga->attr); gss_release_buffer(&discard, ga->name); @@ -258,7 +256,7 @@ done: } free(global_mechs.desc); global_mechs.desc = NULL; - for (i = 0; i < global_mechs.info_len; i++) { + for (unsigned i = 0; i < global_mechs.info_len; i++) { gi = &global_mechs.info[i]; gss_release_oid(&discard, &gi->mech); gss_release_oid_set(&discard, &gi->name_types); @@ -335,7 +333,6 @@ OM_uint32 gpm_inquire_names_for_mech(OM_uint32 *minor_status, { uint32_t ret_min; uint32_t ret_maj; - int i;
if (!minor_status) { return GSS_S_CALL_INACCESSIBLE_WRITE; @@ -351,7 +348,7 @@ OM_uint32 gpm_inquire_names_for_mech(OM_uint32 *minor_status, return GSS_S_FAILURE; }
- for (i = 0; i < global_mechs.info_len; i++) { + for (unsigned i = 0; i < global_mechs.info_len; i++) { if (!gpm_equal_oids(global_mechs.info[i].mech, mech_type)) { continue; } @@ -375,7 +372,6 @@ OM_uint32 gpm_inquire_mechs_for_name(OM_uint32 *minor_status, uint32_t discard; gss_OID name_type = GSS_C_NO_OID; int present; - int i;
if (!minor_status) { return GSS_S_CALL_INACCESSIBLE_WRITE; @@ -402,7 +398,7 @@ OM_uint32 gpm_inquire_mechs_for_name(OM_uint32 *minor_status, goto done; }
- for (i = 0; i < global_mechs.info_len; i++) { + for (unsigned i = 0; i < global_mechs.info_len; i++) { ret_maj = gss_test_oid_set_member(&ret_min, name_type, global_mechs.info[i].name_types, &present); @@ -439,7 +435,6 @@ OM_uint32 gpm_inquire_attrs_for_mech(OM_uint32 *minor_status, uint32_t ret_min; uint32_t ret_maj; uint32_t discard; - int i;
if (!minor_status) { return GSS_S_CALL_INACCESSIBLE_WRITE; @@ -451,7 +446,7 @@ OM_uint32 gpm_inquire_attrs_for_mech(OM_uint32 *minor_status, return GSS_S_FAILURE; }
- for (i = 0; i < global_mechs.info_len; i++) { + for (unsigned i = 0; i < global_mechs.info_len; i++) { if (!gpm_equal_oids(global_mechs.info[i].mech, mech)) { continue; } @@ -495,7 +490,6 @@ OM_uint32 gpm_inquire_saslname_for_mech(OM_uint32 *minor_status, uint32_t ret_min; uint32_t ret_maj; uint32_t discard; - int i;
if (!minor_status) { return GSS_S_CALL_INACCESSIBLE_WRITE; @@ -511,7 +505,7 @@ OM_uint32 gpm_inquire_saslname_for_mech(OM_uint32 *minor_status, return GSS_S_FAILURE; }
- for (i = 0; i < global_mechs.info_len; i++) { + for (unsigned i = 0; i < global_mechs.info_len; i++) { if (!gpm_equal_oids(global_mechs.info[i].mech, desired_mech)) { continue; } @@ -554,7 +548,6 @@ OM_uint32 gpm_display_mech_attr(OM_uint32 *minor_status, uint32_t ret_min; uint32_t ret_maj; uint32_t discard; - int i;
if (!minor_status) { return GSS_S_CALL_INACCESSIBLE_WRITE; @@ -570,7 +563,7 @@ OM_uint32 gpm_display_mech_attr(OM_uint32 *minor_status, return GSS_S_FAILURE; }
- for (i = 0; i < global_mechs.desc_len; i++) { + for (unsigned i = 0; i < global_mechs.desc_len; i++) { if (!gpm_equal_oids(global_mechs.desc[i].attr, mech_attr)) { continue; } @@ -614,7 +607,6 @@ OM_uint32 gpm_indicate_mechs_by_attrs(OM_uint32 *minor_status, uint32_t ret_maj; uint32_t discard; int present; - int i, j;
if (!minor_status) { return GSS_S_CALL_INACCESSIBLE_WRITE; @@ -636,8 +628,9 @@ OM_uint32 gpm_indicate_mechs_by_attrs(OM_uint32 *minor_status, return ret_maj; }
- for (i = 0; i < global_mechs.info_len; i++) { + for (unsigned i = 0; i < global_mechs.info_len; i++) { if (desired_mech_attrs != GSS_C_NO_OID_SET) { + unsigned j; for (j = 0; j < desired_mech_attrs->count; j++) { ret_maj = gss_test_oid_set_member(&ret_min, &desired_mech_attrs->elements[j], @@ -657,6 +650,7 @@ OM_uint32 gpm_indicate_mechs_by_attrs(OM_uint32 *minor_status, } } if (except_mech_attrs != GSS_C_NO_OID_SET) { + unsigned j; for (j = 0; j < except_mech_attrs->count; j++) { ret_maj = gss_test_oid_set_member(&ret_min, &except_mech_attrs->elements[j], @@ -676,6 +670,7 @@ OM_uint32 gpm_indicate_mechs_by_attrs(OM_uint32 *minor_status, } } if (critical_mech_attrs != GSS_C_NO_OID_SET) { + unsigned j; for (j = 0; j < critical_mech_attrs->count; j++) { ret_maj = gss_test_oid_set_member(&ret_min, &critical_mech_attrs->elements[j], diff --git a/proxy/src/gp_common.h b/proxy/src/gp_common.h index edc23b4..4f76e58 100644 --- a/proxy/src/gp_common.h +++ b/proxy/src/gp_common.h @@ -104,9 +104,8 @@ union gp_rpc_res { #define gp_options_find(res, opts, name, len) \ do { \ struct gssx_option *_v; \ - int _o; \ res = NULL; \ - for (_o = 0; _o < opts.options_len; _o++) { \ + for (unsigned _o = 0; _o < opts.options_len; _o++) { \ _v = &opts.options_val[_o]; \ if (gp_option_name_match(_v, name, len)) { \ res = _v; \ diff --git a/proxy/src/gp_config.c b/proxy/src/gp_config.c index 5c1ca02..a671333 100644 --- a/proxy/src/gp_config.c +++ b/proxy/src/gp_config.c @@ -57,11 +57,9 @@ static void free_str_array(const char ***a, int *count)
void free_cred_store_elements(gss_key_value_set_desc *cs) { - int i; - if (!cs->elements) return;
- for (i = 0; i < cs->count; i++) { + for (unsigned i = 0; i < cs->count; i++) { safefree(cs->elements[i].key); safefree(cs->elements[i].value); } @@ -146,7 +144,7 @@ static int get_krb5_mech_cfg(struct gp_service *svc, &count, &strings); if (ret == 0) { const char *p; - size_t len; + ssize_t len; char *key;
svc->krb5.store.elements = @@ -698,7 +696,6 @@ struct gp_creds_handle *gp_service_get_creds_handle(struct gp_service *svc) void free_config(struct gp_config **cfg) { struct gp_config *config = *cfg; - uint32_t i;
if (!config) { return; @@ -709,7 +706,7 @@ void free_config(struct gp_config **cfg) free(config->socket_name); free(config->proxy_user);
- for (i=0; i < config->num_svcs; i++) { + for (int i = 0; i < config->num_svcs; i++) { gp_service_free(config->svcs[i]); safefree(config->svcs[i]); } diff --git a/proxy/src/gp_conv.c b/proxy/src/gp_conv.c index 71d6d9d..b874b06 100644 --- a/proxy/src/gp_conv.c +++ b/proxy/src/gp_conv.c @@ -599,7 +599,6 @@ done: int gp_conv_gssx_to_oid_set(gssx_OID_set *in, gss_OID_set *out) { gss_OID_set o; - int i;
if (in->gssx_OID_set_len == 0) { *out = GSS_C_NO_OID_SET; @@ -618,7 +617,7 @@ int gp_conv_gssx_to_oid_set(gssx_OID_set *in, gss_OID_set *out) return ENOMEM; }
- for (i = 0; i < o->count; i++) { + for (size_t i = 0; i < o->count; i++) { o->elements[i].elements = gp_memdup(in->gssx_OID_set_val[i].octet_string_val, in->gssx_OID_set_val[i].octet_string_len); @@ -641,7 +640,6 @@ int gp_conv_gssx_to_oid_set(gssx_OID_set *in, gss_OID_set *out) int gp_conv_oid_set_to_gssx(gss_OID_set in, gssx_OID_set *out) { int ret; - int i;
if (in->count == 0) { return 0; @@ -653,7 +651,7 @@ int gp_conv_oid_set_to_gssx(gss_OID_set in, gssx_OID_set *out) return ENOMEM; }
- for (i = 0; i < in->count; i++) { + for (size_t i = 0; i < in->count; i++) { ret = gp_conv_octet_string(in->elements[i].length, in->elements[i].elements, &out->gssx_OID_set_val[i]); diff --git a/proxy/src/gp_creds.c b/proxy/src/gp_creds.c index 6570b06..e05ad01 100644 --- a/proxy/src/gp_creds.c +++ b/proxy/src/gp_creds.c @@ -312,7 +312,6 @@ static int gp_get_cred_environment(struct gp_call_ctx *gpcall, int k_num = -1; int ck_num = -1; int cc_num = -1; - int d;
memset(cs, 0, sizeof(gss_key_value_set_desc));
@@ -419,7 +418,7 @@ static int gp_get_cred_environment(struct gp_call_ctx *gpcall, ret = ENOMEM; goto done; } - for (d = 0; d < svc->krb5.store.count; d++) { + for (unsigned d = 0; d < svc->krb5.store.count; d++) { if (strcmp(svc->krb5.store.elements[d].key, "client_keytab") == 0) { ck_num = cs->count; } else if (strcmp(svc->krb5.store.elements[d].key, "keytab") == 0) { diff --git a/proxy/src/gp_export.c b/proxy/src/gp_export.c index 12b8d5f..3a927c9 100644 --- a/proxy/src/gp_export.c +++ b/proxy/src/gp_export.c @@ -288,7 +288,6 @@ uint32_t gp_export_gssx_cred(uint32_t *min, struct gp_call_ctx *gpcall, uint32_t acceptor_lifetime = 0; struct gssx_cred_element *el; int ret; - int i, j; struct gp_creds_handle *handle = NULL; gss_buffer_desc token = GSS_C_EMPTY_BUFFER;
@@ -314,8 +313,7 @@ uint32_t gp_export_gssx_cred(uint32_t *min, struct gp_call_ctx *gpcall, } out->elements.elements_len = mechanisms->count;
- for (i = 0, j = 0; i < mechanisms->count; i++, j++) { - + for (unsigned i = 0, j = 0; i < mechanisms->count; i++, j++) { el = &out->elements.elements_val[j];
ret_maj = gss_inquire_cred_by_mech(&ret_min, *in, @@ -399,11 +397,10 @@ static void gp_set_cred_options(gssx_cred *cred, gss_cred_id_t gss_cred) krb5_enctype *ktypes; bool no_ci_flags = false; uint32_t maj, min; - int i, j;
- for (i = 0; i < cred->elements.elements_len; i++) { + for (unsigned i = 0; i < cred->elements.elements_len; i++) { ce = &cred->elements.elements_val[i]; - for (j = 0; j < ce->options.options_len; j++) { + for (unsigned j = 0; j < ce->options.options_len; j++) { op = &ce->options.options_val[j]; if ((op->option.octet_string_len == sizeof(KRB5_SET_ALLOWED_ENCTYPE)) && diff --git a/proxy/src/gp_rpc_acquire_cred.c b/proxy/src/gp_rpc_acquire_cred.c index e9c7d56..fcb4fbe 100644 --- a/proxy/src/gp_rpc_acquire_cred.c +++ b/proxy/src/gp_rpc_acquire_cred.c @@ -20,7 +20,6 @@ int gp_acquire_cred(struct gp_call_ctx *gpcall, gss_cred_id_t *add_out_cred = NULL; int acquire_type = ACQ_NORMAL; int ret; - int i;
aca = &arg->acquire_cred; acr = &res->acquire_cred; @@ -63,7 +62,7 @@ int gp_acquire_cred(struct gp_call_ctx *gpcall, goto done; }
- for (i = 0; i < desired_mechs->count; i++) { + for (unsigned i = 0; i < desired_mechs->count; i++) { desired_mech = &desired_mechs->elements[i];
if (!gp_creds_allowed_mech(gpcall, desired_mech)) { @@ -93,7 +92,7 @@ int gp_acquire_cred(struct gp_call_ctx *gpcall,
cred_usage = gp_conv_gssx_to_cred_usage(aca->cred_usage);
- for (i = 0; i < use_mechs->count; i++) { + for (unsigned i = 0; i < use_mechs->count; i++) { desired_mech = &use_mechs->elements[i]; /* this should really be folded into an extended * gss_add_cred in gssapi that can accept a set of URIs diff --git a/proxy/src/gp_rpc_debug.c b/proxy/src/gp_rpc_debug.c index 2e2c050..a814448 100644 --- a/proxy/src/gp_rpc_debug.c +++ b/proxy/src/gp_rpc_debug.c @@ -19,7 +19,7 @@ void gpdbg_octet_string(octet_string *x) } fprintf(stderr, "... ] "); } else { - for (int i = 0; i < x->octet_string_len; i++) { + for (unsigned i = 0; i < x->octet_string_len; i++) { fprintf(stderr, "%x", x->octet_string_val[i]); } fprintf(stderr, " ] "); @@ -55,7 +55,7 @@ void gpdbg_gssx_OID(gssx_OID *x) void gpdbg_gssx_OID_set(gssx_OID_set *x) { gp_debug_printf("{ "); - for (int i = 0; i < x->gssx_OID_set_len; i++) { + for (unsigned i = 0; i < x->gssx_OID_set_len; i++) { gpdbg_gssx_OID(&x->gssx_OID_set_val[i]); } gp_debug_printf("} "); @@ -90,7 +90,7 @@ void gpdbg_gssx_option(gssx_option *x) #define gpdbg_extensions(x) do { \ if ((x)->extensions.extensions_len > 0) { \ gp_debug_printf("[ "); \ - for (int i = 0; i < (x)->extensions.extensions_len; i++) { \ + for (unsigned i = 0; i < (x)->extensions.extensions_len; i++) { \ gpdbg_gssx_option(&(x)->extensions.extensions_val[i]); \ } \ gp_debug_printf("] "); \ @@ -100,7 +100,7 @@ void gpdbg_gssx_option(gssx_option *x) #define gpdbg_options(x) do { \ if ((x)->options.options_len > 0) { \ gp_debug_printf("[ "); \ - for (int i = 0; i < (x)->options.options_len; i++) { \ + for (unsigned i = 0; i < (x)->options.options_len; i++) { \ gpdbg_gssx_option(&(x)->options.options_val[i]); \ } \ gp_debug_printf("] "); \ @@ -168,7 +168,7 @@ void gpdbg_gssx_call_ctx(gssx_call_ctx *x) #define gpdbg_name_attributes(X) do { \ gp_debug_printf("[ "); \ if (x->name_attributes.name_attributes_len > 0) { \ - for (int i = 0; i < x->name_attributes.name_attributes_len; i++) { \ + for (unsigned i = 0; i < x->name_attributes.name_attributes_len; i++) { \ gpdbg_gssx_name_attr( \ &x->name_attributes.name_attributes_val[i]); \ } \ @@ -209,7 +209,7 @@ void gpdbg_gssx_cred(gssx_cred *x) gp_debug_printf("{ "); gpdbg_gssx_name(&x->desired_name); gp_debug_printf("[ "); - for (int i = 0; i < x->elements.elements_len; i++) { + for (unsigned i = 0; i < x->elements.elements_len; i++) { gpdbg_gssx_cred_element(&x->elements.elements_val[i]); } gp_debug_printf("] "); @@ -289,17 +289,17 @@ void gpdbg_gssx_res_indicate_mechs(gssx_res_indicate_mechs *x) gp_debug_printf(" GSSX_RES_INDICATE_MECHS( status: "); gpdbg_gssx_status(&x->status); gp_debug_printf("mechs: [ "); - for (int i = 0; i < x->mechs.mechs_len; i++) { + for (unsigned i = 0; i < x->mechs.mechs_len; i++) { gpdbg_gssx_mech_info(&x->mechs.mechs_val[i]); } gp_debug_printf("] "); gp_debug_printf("mech_attr_descs: [ "); - for (int i = 0; i < x->mech_attr_descs.mech_attr_descs_len; i++) { + for (unsigned i = 0; i < x->mech_attr_descs.mech_attr_descs_len; i++) { gpdbg_gssx_mech_attr(&x->mech_attr_descs.mech_attr_descs_val[i]); } gp_debug_printf("] "); gp_debug_printf("supported_extensions: [ "); - for (int i = 0; + for (unsigned i = 0; i < x->supported_extensions.supported_extensions_len; i++) { gpdbg_gssx_buffer( &x->supported_extensions.supported_extensions_val[i]); @@ -602,7 +602,7 @@ void gpdbg_gssx_arg_wrap(gssx_arg_wrap *x) gp_debug_printf("conf_req: "); gp_debug_printf("%d ", (int)x->conf_req); gp_debug_printf("message_buffer: [ "); - for (int i = 0; i < x->message_buffer.message_buffer_len; i++) { + for (unsigned i = 0; i < x->message_buffer.message_buffer_len; i++) { gpdbg_octet_string(&x->message_buffer.message_buffer_val[i]); } gp_debug_printf("] "); @@ -618,7 +618,7 @@ void gpdbg_gssx_res_wrap(gssx_res_wrap *x) gp_debug_printf("context_handle: "); GPRPCDEBUG(gssx_ctx, x->context_handle); gp_debug_printf("token_buffer: [ "); - for (int i = 0; i < x->token_buffer.token_buffer_len; i++) { + for (unsigned i = 0; i < x->token_buffer.token_buffer_len; i++) { gpdbg_octet_string(&x->token_buffer.token_buffer_val[i]); } gp_debug_printf("] "); @@ -640,7 +640,7 @@ void gpdbg_gssx_arg_unwrap(gssx_arg_unwrap *x) gp_debug_printf("context_handle: "); gpdbg_gssx_ctx(&x->context_handle); gp_debug_printf("token_buffer: [ "); - for (int i = 0; i < x->token_buffer.token_buffer_len; i++) { + for (unsigned i = 0; i < x->token_buffer.token_buffer_len; i++) { gpdbg_octet_string(&x->token_buffer.token_buffer_val[i]); } gp_debug_printf("] "); @@ -656,7 +656,7 @@ void gpdbg_gssx_res_unwrap(gssx_res_unwrap *x) gp_debug_printf("context_handle: "); GPRPCDEBUG(gssx_ctx, x->context_handle); gp_debug_printf("message_buffer: [ "); - for (int i = 0; i < x->message_buffer.message_buffer_len; i++) { + for (unsigned i = 0; i < x->message_buffer.message_buffer_len; i++) { gpdbg_octet_string(&x->message_buffer.message_buffer_val[i]); } gp_debug_printf("] "); diff --git a/proxy/src/gp_rpc_indicate_mechs.c b/proxy/src/gp_rpc_indicate_mechs.c index 8abbc7f..6ae6756 100644 --- a/proxy/src/gp_rpc_indicate_mechs.c +++ b/proxy/src/gp_rpc_indicate_mechs.c @@ -25,8 +25,7 @@ int gp_indicate_mechs(struct gp_call_ctx *gpcall UNUSED, uint32_t ret_maj; uint32_t ret_min; int present; - int h, i, j; - int ret; + int ret;
ima = &arg->indicate_mechs; imr = &res->indicate_mechs; @@ -53,8 +52,7 @@ int gp_indicate_mechs(struct gp_call_ctx *gpcall UNUSED, } imr->mechs.mechs_len = mech_set->count;
- for (i = 0, h = 0; i < mech_set->count; i++, h++) { - + for (unsigned i = 0, h = 0; i < mech_set->count; i++, h++) { mi = &imr->mechs.mechs_val[h];
ret = gp_conv_oid_to_gssx(&mech_set->elements[i], &mi->mech); @@ -104,8 +102,7 @@ int gp_indicate_mechs(struct gp_call_ctx *gpcall UNUSED, ret_min = ret; goto done; } - for (j = 0; j < mech_attrs->count; j++) { - + for (unsigned j = 0; j < mech_attrs->count; j++) { ret_maj = gss_test_oid_set_member(&ret_min, &mech_attrs->elements[j], attr_set, @@ -136,8 +133,7 @@ int gp_indicate_mechs(struct gp_call_ctx *gpcall UNUSED, goto done; }
- for (j = 0; j < known_mech_attrs->count; j++) { - + for (unsigned j = 0; j < known_mech_attrs->count; j++) { ret_maj = gss_test_oid_set_member(&ret_min, &known_mech_attrs->elements[j], attr_set, @@ -205,8 +201,7 @@ int gp_indicate_mechs(struct gp_call_ctx *gpcall UNUSED, } imr->mech_attr_descs.mech_attr_descs_len = attr_set->count;
- for (i = 0; i < attr_set->count; i++) { - + for (unsigned i = 0; i < attr_set->count; i++) { ma = &imr->mech_attr_descs.mech_attr_descs_val[i];
ret = gp_conv_oid_to_gssx(&attr_set->elements[i], &ma->attr); diff --git a/proxy/src/gp_socket.c b/proxy/src/gp_socket.c index 829ff21..17ecf7c 100644 --- a/proxy/src/gp_socket.c +++ b/proxy/src/gp_socket.c @@ -303,7 +303,7 @@ static void gp_socket_read(verto_ctx *vctx, verto_ev *ev) struct gp_buffer *rbuf; uint32_t size; bool header = false; - size_t rn; + ssize_t rn; int ret; int fd;
@@ -487,7 +487,7 @@ static void gp_socket_write(verto_ctx *vctx, verto_ev *ev) return; } if (vecs == 2) { - if (wn < sizeof(size)) { + if (wn < (ssize_t) sizeof(size)) { /* don't bother trying to handle sockets that can't * buffer even 4 bytes */ gp_conn_free(wbuf->conn); diff --git a/proxy/src/gp_util.c b/proxy/src/gp_util.c index ca83eb3..f158b84 100644 --- a/proxy/src/gp_util.c +++ b/proxy/src/gp_util.c @@ -109,7 +109,7 @@ char *gp_strerror(int errnum) ssize_t gp_safe_read(int fd, void *buf, size_t count) { char *b = (char *)buf; - ssize_t len = 0; + size_t len = 0; ssize_t ret;
do { @@ -128,7 +128,7 @@ ssize_t gp_safe_read(int fd, void *buf, size_t count) ssize_t gp_safe_write(int fd, const void *buf, size_t count) { const char *b = (const char *)buf; - ssize_t len = 0; + size_t len = 0; ssize_t ret;
do { diff --git a/proxy/tests/t_utils.c b/proxy/tests/t_utils.c index 6af9a16..36f7bd1 100644 --- a/proxy/tests/t_utils.c +++ b/proxy/tests/t_utils.c @@ -8,7 +8,7 @@ int t_send_buffer(int fd, char *buf, uint32_t len) { uint32_t size; - size_t wn; + ssize_t wn; size_t pos;
size = htonl(len); @@ -36,7 +36,7 @@ int t_send_buffer(int fd, char *buf, uint32_t len) int t_recv_buffer(int fd, char *buf, uint32_t *len) { uint32_t size; - size_t rn; + ssize_t rn; size_t pos;
rn = read(fd, &size, sizeof(uint32_t));
This is an automated email from the git hooks/post-receive script.
rharwood pushed a commit to branch master in repository gssproxy.
commit 10e0a869940b0e8c3624b0a2c5a490edcdf49174 Author: Robbie Harwood rharwood@redhat.com Date: Wed Mar 15 14:57:57 2017 -0400
Fix error checking on get_impersonator_fallback()
Separate commit to ease backporting.
Signed-off-by: Robbie Harwood rharwood@redhat.com Reviewed-by: Simo Sorce simo@redhat.com Merges: #173 --- proxy/src/gp_creds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/proxy/src/gp_creds.c b/proxy/src/gp_creds.c index e05ad01..fdc6bdf 100644 --- a/proxy/src/gp_creds.c +++ b/proxy/src/gp_creds.c @@ -885,7 +885,7 @@ static uint32_t get_impersonator_name(uint32_t *min, gss_cred_id_t cred, * release that supports this call */ ret_maj = get_impersonator_fallback(&ret_min, cred, impersonator); if (ret_maj == GSS_S_FAILURE) { - if (ret_min == KRB5_CC_NOTFOUND) { + if (ret_min == (uint32_t)KRB5_CC_NOTFOUND) { ret_min = ENOENT; ret_maj = GSS_S_COMPLETE; }
This is an automated email from the git hooks/post-receive script.
rharwood pushed a commit to branch master in repository gssproxy.
commit b50a863b20649b80cc44c88aa325c6c3220af61b Author: Robbie Harwood rharwood@redhat.com Date: Thu Mar 23 13:42:55 2017 -0400
Remove gpm_release_ctx() to fix double unlock
Signed-off-by: Robbie Harwood rharwood@redhat.com Reviewed-by: Simo Sorce simo@redhat.com Merges: #173 --- proxy/src/client/gpm_common.c | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/proxy/src/client/gpm_common.c b/proxy/src/client/gpm_common.c index 8c96986..69f4741 100644 --- a/proxy/src/client/gpm_common.c +++ b/proxy/src/client/gpm_common.c @@ -312,11 +312,6 @@ static struct gpm_ctx *gpm_get_ctx(void) return &gpm_global_ctx; }
-static void gpm_release_ctx(struct gpm_ctx *gpmctx) -{ - gpm_release_sock(gpmctx); -} - OM_uint32 gpm_release_buffer(OM_uint32 *minor_status, gss_buffer_t buffer) { @@ -503,7 +498,6 @@ done: xdr_free((xdrproc_t)xdr_gp_rpc_msg, (char *)&msg); xdr_destroy(&xdr_call_ctx); xdr_destroy(&xdr_reply_ctx); - gpm_release_ctx(gpmctx); return ret; }
gss-proxy@lists.fedorahosted.org