1   /*
   2    * Copyright (c) 1996,1997, by Sun Microsystems, Inc.
   3    * All rights reserved.
   4    */
   5   
   6 | #pragma ident        "@(#)g_process_context.c        1.13        04/09/08 SMI"
   6 | #pragma ident        "@(#)g_process_context.c        1.12        98/01/22 SMI"
   7   
   8   /*
   9    *  glue routine gss_process_context
  10    */
  11   
  12   #include <mechglueP.h>
  13   
  14   OM_uint32
  15   gss_process_context_token(minor_status,
  16                                   context_handle,
  17                                   token_buffer)
  18   
  19   OM_uint32 *                        minor_status;
  20   const gss_ctx_id_t                context_handle;
  21   gss_buffer_t                        token_buffer;
  22   
  23   {
  24           OM_uint32                status;
  25           gss_union_ctx_id_t        ctx;
  26           gss_mechanism                mech;
  27   
  28 |         gss_initialize();
  28 |         if (minor_status == NULL)
  29 +                 return (GSS_S_CALL_INACCESSIBLE_WRITE);
  30 +         *minor_status = 0;
  31   
  32           if (context_handle == GSS_C_NO_CONTEXT)
  31 |                 return (GSS_S_NO_CONTEXT);
  33 |                 return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT);
  34   
  35 +         if (GSS_EMPTY_BUFFER(token_buffer))
  36 +                 return (GSS_S_CALL_INACCESSIBLE_READ);
  37 + 
  38           /*
  39            * select the approprate underlying mechanism routine and
  40            * call it.
  41            */
  42   
  43           ctx = (gss_union_ctx_id_t) context_handle;
  44           mech = __gss_get_mechanism(ctx->mech_type);
  45   
  46           if (mech) {
  47   
  48                   if (mech->gss_process_context_token)
  49                           status = mech->gss_process_context_token(
  50                                                           mech->context,
  51                                                           minor_status,
  52                                                           ctx->internal_ctx_id,
  53                                                           token_buffer);
  54                   else
  50 |                         status = GSS_S_BAD_BINDINGS;
  55 |                         status = GSS_S_UNAVAILABLE;
  56   
  57                   return (status);
  58           }
  59   
  55 |         return (GSS_S_NO_CONTEXT);
  60 |         return (GSS_S_BAD_MECH);
  61   }

 ----Unchanged portion omitted----