LCOV - code coverage report
Current view: top level - lib/gs2 - gs2helper.c (source / functions) Hit Total Coverage
Test: GNU SASL Lines: 7 9 77.8 %
Date: 2010-09-27 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 4 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* gs2helper.c --- GS2 helper functions common to client and server.
       2                 :            :  * Copyright (C) 2010  Simon Josefsson
       3                 :            :  *
       4                 :            :  * This file is part of GNU SASL Library.
       5                 :            :  *
       6                 :            :  * GNU SASL Library is free software; you can redistribute it and/or
       7                 :            :  * modify it under the terms of the GNU Lesser General Public License
       8                 :            :  * as published by the Free Software Foundation; either version 2.1 of
       9                 :            :  * the License, or (at your option) any later version.
      10                 :            :  *
      11                 :            :  * GNU SASL Library is distributed in the hope that it will be useful,
      12                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14                 :            :  * Lesser General Public License for more details.
      15                 :            :  *
      16                 :            :  * You should have received a copy of the GNU Lesser General Public
      17                 :            :  * License along with GNU SASL Library; if not, write to the Free
      18                 :            :  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
      19                 :            :  * Boston, MA 02110-1301, USA.
      20                 :            :  *
      21                 :            :  */
      22                 :            : 
      23                 :            : #ifdef HAVE_CONFIG_H
      24                 :            : # include "config.h"
      25                 :            : #endif
      26                 :            : 
      27                 :            : /* Get strcmp. */
      28                 :            : #include <string.h>
      29                 :            : 
      30                 :            : /* Get malloc, free. */
      31                 :            : #include <stdlib.h>
      32                 :            : 
      33                 :            : /* Get specification. */
      34                 :            : #include "gs2helper.h"
      35                 :            : 
      36                 :            : /* Populate mech_oid with OID for the current SASL mechanism name.  A
      37                 :            :    bit silly given that we only support Kerberos V5 today, but will be
      38                 :            :    useful when that changes.  */
      39                 :            : int
      40                 :         21 : gs2_get_oid (Gsasl_session * sctx, gss_OID * mech_oid)
      41                 :            : {
      42                 :            :   gss_buffer_desc sasl_mech_name;
      43                 :            :   OM_uint32 maj_stat, min_stat;
      44                 :            : 
      45                 :         21 :   sasl_mech_name.value = (void *) gsasl_mechanism_name (sctx);
      46         [ -  + ]:         21 :   if (!sasl_mech_name.value)
      47                 :          0 :     return GSASL_AUTHENTICATION_ERROR;
      48                 :         21 :   sasl_mech_name.length = strlen (sasl_mech_name.value);
      49                 :            : 
      50                 :         21 :   maj_stat = gss_inquire_mech_for_saslname (&min_stat, &sasl_mech_name,
      51                 :            :                                             mech_oid);
      52         [ -  + ]:         21 :   if (GSS_ERROR (maj_stat))
      53                 :          0 :     return GSASL_GSSAPI_INQUIRE_MECH_FOR_SASLNAME_ERROR;
      54                 :            : 
      55                 :         21 :   return GSASL_OK;
      56                 :            : }

Generated by: LCOV version 1.8