|
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 |