View | Details | Raw Unified | Return to bug 1225
Collapse All | Expand All

(-)gss-genr.c (-43 lines)
Lines 226-264 Link Here
226
	return (ctx->major);
226
	return (ctx->major);
227
}
227
}
228
228
229
/* Acquire credentials for a server running on the current host.
230
 * Requires that the context structure contains a valid OID
231
 */
232
233
/* Returns a GSSAPI error code */
234
OM_uint32
235
ssh_gssapi_acquire_cred(Gssctxt *ctx)
236
{
237
	OM_uint32 status;
238
	char lname[MAXHOSTNAMELEN];
239
	gss_OID_set oidset;
240
241
	gss_create_empty_oid_set(&status, &oidset);
242
	gss_add_oid_set_member(&status, ctx->oid, &oidset);
243
244
	if (gethostname(lname, MAXHOSTNAMELEN)) {
245
		gss_release_oid_set(&status, &oidset);
246
		return (-1);
247
	}
248
249
	if (GSS_ERROR(ssh_gssapi_import_name(ctx, lname))) {
250
		gss_release_oid_set(&status, &oidset);
251
		return (ctx->major);
252
	}
253
254
	if ((ctx->major = gss_acquire_cred(&ctx->minor,
255
	    ctx->name, 0, oidset, GSS_C_ACCEPT, &ctx->creds, NULL, NULL)))
256
		ssh_gssapi_error(ctx);
257
258
	gss_release_oid_set(&status, &oidset);
259
	return (ctx->major);
260
}
261
262
OM_uint32
229
OM_uint32
263
ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_t buffer, gss_buffer_t hash)
230
ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_t buffer, gss_buffer_t hash)
264
{
231
{
Lines 279-294 Link Here
279
	buffer_put_cstring(b, user);
246
	buffer_put_cstring(b, user);
280
	buffer_put_cstring(b, service);
247
	buffer_put_cstring(b, service);
281
	buffer_put_cstring(b, context);
248
	buffer_put_cstring(b, context);
282
}
283
284
OM_uint32
285
ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid)
286
{
287
	if (*ctx)
288
		ssh_gssapi_delete_ctx(ctx);
289
	ssh_gssapi_build_ctx(ctx);
290
	ssh_gssapi_set_oid(*ctx, oid);
291
	return (ssh_gssapi_acquire_cred(*ctx));
292
}
249
}
293
250
294
int
251
int
(-)gss-serv.c (+43 lines)
Lines 89-94 Link Here
89
	gss_release_oid_set(&min_status, &supported);
89
	gss_release_oid_set(&min_status, &supported);
90
}
90
}
91
91
92
OM_uint32
93
ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid)
94
{
95
	if (*ctx)
96
		ssh_gssapi_delete_ctx(ctx);
97
	ssh_gssapi_build_ctx(ctx);
98
	ssh_gssapi_set_oid(*ctx, oid);
99
	return (ssh_gssapi_acquire_cred(*ctx));
100
}
101
102
/* Acquire credentials for a server running on the current host.
103
 * Requires that the context structure contains a valid OID
104
 */
105
106
/* Returns a GSSAPI error code */
107
OM_uint32
108
ssh_gssapi_acquire_cred(Gssctxt *ctx)
109
{
110
	OM_uint32 status;
111
	char lname[MAXHOSTNAMELEN];
112
	gss_OID_set oidset;
113
114
	gss_create_empty_oid_set(&status, &oidset);
115
	gss_add_oid_set_member(&status, ctx->oid, &oidset);
116
117
	if (gethostname(lname, MAXHOSTNAMELEN)) {
118
		gss_release_oid_set(&status, &oidset);
119
		return (-1);
120
	}
121
122
	if (GSS_ERROR(ssh_gssapi_import_name(ctx, lname))) {
123
		gss_release_oid_set(&status, &oidset);
124
		return (ctx->major);
125
	}
126
127
	if ((ctx->major = gss_acquire_cred(&ctx->minor,
128
	    ctx->name, 0, oidset, GSS_C_ACCEPT, &ctx->creds, NULL, NULL)))
129
		ssh_gssapi_error(ctx);
130
131
	gss_release_oid_set(&status, &oidset);
132
	return (ctx->major);
133
}
134
92
135
93
/* Wrapper around accept_sec_context
136
/* Wrapper around accept_sec_context
94
 * Requires that the context contains:
137
 * Requires that the context contains:

Return to bug 1225