~ubuntu-branches/ubuntu/precise/krb5/precise-updates

« back to all changes in this revision

Viewing changes to src/lib/gssapi/krb5/k5sealiov.c

  • Committer: Package Import Robot
  • Author(s): Sam Hartman
  • Date: 2011-12-01 19:34:41 UTC
  • mfrom: (28.1.14 sid)
  • Revision ID: package-import@ubuntu.com-20111201193441-9tipg3aru1jsidyv
Tags: 1.10+dfsg~alpha1-6
* Fix segfault with unknown hostnames in krb5_sname_to_principal,
  Closes: #650671
* Indicate that this library breaks libsmbclient versions that depend on
  krb5_locate_kdc, Closes: #650603, #650611

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
 
2
/* lib/gssapi/krb5/k5sealiov.c */
2
3
/*
3
 
 * lib/gssapi/krb5/k5sealiov.c
4
 
 *
5
4
 * Copyright 2008, 2009 by the Massachusetts Institute of Technology.
6
5
 * All Rights Reserved.
7
6
 *
23
22
 * M.I.T. makes no representations about the suitability of
24
23
 * this software for any purpose.  It is provided "as is" without express
25
24
 * or implied warranty.
26
 
 *
27
 
 *
28
25
 */
29
26
 
30
27
#include <assert.h>
192
189
    switch (ctx->signalg) {
193
190
    case SGN_ALG_DES_MAC_MD5:
194
191
    case SGN_ALG_3:
195
 
        code = kg_encrypt(context, ctx->seq, KG_USAGE_SEAL,
196
 
                          (g_OID_equal(ctx->mech_used, gss_mech_krb5_old) ?
197
 
                           ctx->seq->keyblock.contents : NULL),
198
 
                          md5cksum.contents, md5cksum.contents, 16);
 
192
        code = kg_encrypt_inplace(context, ctx->seq, KG_USAGE_SEAL,
 
193
                                  (g_OID_equal(ctx->mech_used,
 
194
                                               gss_mech_krb5_old) ?
 
195
                                   ctx->seq->keyblock.contents : NULL),
 
196
                                  md5cksum.contents, 16);
199
197
        if (code != 0)
200
198
            goto cleanup;
201
199
 
286
284
        return GSS_S_FAILURE;
287
285
    }
288
286
 
289
 
    if (!kg_validate_ctx_id(context_handle)) {
290
 
        *minor_status = (OM_uint32)G_VALIDATE_FAILED;
291
 
        return GSS_S_NO_CONTEXT;
292
 
    }
293
 
 
294
287
    ctx = (krb5_gss_ctx_id_rec *)context_handle;
295
288
    if (!ctx->established) {
296
289
        *minor_status = KG_CTX_INCOMPLETE;
355
348
        return GSS_S_FAILURE;
356
349
    }
357
350
 
358
 
    if (!kg_validate_ctx_id(context_handle)) {
359
 
        *minor_status = (OM_uint32)G_VALIDATE_FAILED;
360
 
        return GSS_S_NO_CONTEXT;
361
 
    }
362
 
 
363
351
    ctx = (krb5_gss_ctx_id_rec *)context_handle;
364
352
    if (!ctx->established) {
365
353
        *minor_status = KG_CTX_INCOMPLETE;
501
489
 
502
490
    return GSS_S_COMPLETE;
503
491
}
 
492
 
 
493
OM_uint32 KRB5_CALLCONV
 
494
krb5_gss_wrap_iov(OM_uint32 *minor_status,
 
495
                  gss_ctx_id_t context_handle,
 
496
                  int conf_req_flag,
 
497
                  gss_qop_t qop_req,
 
498
                  int *conf_state,
 
499
                  gss_iov_buffer_desc *iov,
 
500
                  int iov_count)
 
501
{
 
502
    OM_uint32 major_status;
 
503
 
 
504
    major_status = kg_seal_iov(minor_status, context_handle, conf_req_flag,
 
505
                               qop_req, conf_state,
 
506
                               iov, iov_count, KG_TOK_WRAP_MSG);
 
507
 
 
508
    return major_status;
 
509
}
 
510
 
 
511
OM_uint32 KRB5_CALLCONV
 
512
krb5_gss_wrap_iov_length(OM_uint32 *minor_status,
 
513
                         gss_ctx_id_t context_handle,
 
514
                         int conf_req_flag,
 
515
                         gss_qop_t qop_req,
 
516
                         int *conf_state,
 
517
                         gss_iov_buffer_desc *iov,
 
518
                         int iov_count)
 
519
{
 
520
    OM_uint32 major_status;
 
521
 
 
522
    major_status = kg_seal_iov_length(minor_status, context_handle, conf_req_flag,
 
523
                                      qop_req, conf_state, iov, iov_count);
 
524
    return major_status;
 
525
}
 
526
 
 
527
#if 0
 
528
OM_uint32
 
529
krb5_gss_get_mic_iov(OM_uint32 *minor_status,
 
530
                     gss_ctx_id_t context_handle,
 
531
                     gss_qop_t qop_req,
 
532
                     gss_iov_buffer_desc *iov,
 
533
                     int iov_count)
 
534
{
 
535
    OM_uint32 major_status;
 
536
 
 
537
    major_status = kg_seal_iov(minor_status, context_handle, FALSE,
 
538
                               qop_req, NULL,
 
539
                               iov, iov_count, KG_TOK_MIC_MSG);
 
540
 
 
541
    return major_status;
 
542
}
 
543
 
 
544
OM_uint32
 
545
krb5_gss_get_mic_iov_length(OM_uint32 *minor_status,
 
546
                            gss_ctx_id_t context_handle,
 
547
                            int conf_req_flag,
 
548
                            gss_qop_t qop_req,
 
549
                            int *conf_state,
 
550
                            gss_iov_buffer_desc *iov,
 
551
                            int iov_count)
 
552
{
 
553
    OM_uint32 major_status;
 
554
 
 
555
    major_status = kg_seal_iov_length(minor_status, context_handle, conf_req_flag,
 
556
                                      qop_req, conf_state, iov, iov_count);
 
557
    return major_status;
 
558
}
 
559
#endif