Skip to content

Commit 3639ccb

Browse files
committed
Change accept/init_sec_context to use the new export context functions
1 parent 8d60795 commit 3639ccb

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

proxy/src/gp_export.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,4 @@ uint32_t gp_export_ctx_id_to_gssx(uint32_t *min, int type,
4040
uint32_t gp_import_gssx_to_ctx_id(uint32_t *min, int type,
4141
gssx_ctx *in, gss_ctx_id_t *out);
4242

43-
/* Compat fns */
44-
#define gp_conv_ctx_id_to_gssx(min, in, out) \
45-
gp_export_ctx_id_to_gssx(min, 0, in, out)
46-
static int32_t dummy_min;
47-
#define gp_conv_gssx_to_ctx_id(in, out) \
48-
(uint32_t)gp_import_gssx_to_ctx_id(&dummy_min, 0, in, out)
49-
5043
#endif /* _GSS_EXPORT_H_ */

proxy/src/gp_rpc_accept_sec_context.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,19 @@ int gp_accept_sec_context(struct gssproxy_ctx *gpctx,
4545
uint32_t ret_flags;
4646
gss_cred_id_t dch = GSS_C_NO_CREDENTIAL;
4747
gss_cred_id_t *pdch = NULL;
48+
int exp_ctx_type;
4849
int ret;
4950

5051
asca = &arg->accept_sec_context;
5152
ascr = &res->accept_sec_context;
5253

54+
exp_ctx_type = gp_get_exported_context_type(&asca->call_ctx);
55+
if (exp_ctx_type == -1) {
56+
ret_maj = GSS_S_FAILURE;
57+
ret_min = EINVAL;
58+
goto done;
59+
}
60+
5361
if (asca->cred_handle) {
5462
ret = gp_find_cred(asca->cred_handle, &ach);
5563
if (ret) {
@@ -105,7 +113,8 @@ int gp_accept_sec_context(struct gssproxy_ctx *gpctx,
105113
ret_min = ENOMEM;
106114
goto done;
107115
}
108-
ret_maj = gp_conv_ctx_id_to_gssx(&ret_min, &ctx, ascr->context_handle);
116+
ret_maj = gp_export_ctx_id_to_gssx(&ret_min, exp_ctx_type,
117+
&ctx, ascr->context_handle);
109118
if (ret_maj) {
110119
goto done;
111120
}

proxy/src/gp_rpc_init_sec_context.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,23 @@ int gp_init_sec_context(struct gssproxy_ctx *gpctx,
4545
gss_buffer_desc obuf = GSS_C_EMPTY_BUFFER;
4646
uint32_t ret_maj;
4747
uint32_t ret_min;
48+
int exp_ctx_type;
4849
int ret;
4950

5051
isca = &arg->init_sec_context;
5152
iscr = &res->init_sec_context;
5253

54+
exp_ctx_type = gp_get_exported_context_type(&isca->call_ctx);
55+
if (exp_ctx_type == -1) {
56+
ret_maj = GSS_S_FAILURE;
57+
ret_min = EINVAL;
58+
goto done;
59+
}
60+
5361
if (isca->context_handle) {
54-
ret = gp_conv_gssx_to_ctx_id(isca->context_handle, &ctx);
55-
if (ret) {
56-
ret_maj = GSS_S_NO_CONTEXT;
57-
ret_min = ret;
62+
ret_maj = gp_import_gssx_to_ctx_id(&ret_min, 0,
63+
isca->context_handle, &ctx);
64+
if (ret_maj) {
5865
goto done;
5966
}
6067
}
@@ -116,7 +123,8 @@ int gp_init_sec_context(struct gssproxy_ctx *gpctx,
116123
ret_min = ENOMEM;
117124
goto done;
118125
}
119-
ret_maj = gp_conv_ctx_id_to_gssx(&ret_min, &ctx, iscr->context_handle);
126+
ret_maj = gp_export_ctx_id_to_gssx(&ret_min, exp_ctx_type,
127+
&ctx, iscr->context_handle);
120128
if (ret_maj) {
121129
goto done;
122130
}

0 commit comments

Comments
 (0)