LCOV - code coverage report
Current view: top level - third_party/heimdal/lib/krb5 - expand_path.c (source / functions) Hit Total Coverage
Test: coverage report for fix-15632 9995c5c2 Lines: 2 9 22.2 %
Date: 2024-04-13 12:30:31 Functions: 1 2 50.0 %

          Line data    Source code
       1             : 
       2             : /***********************************************************************
       3             :  * Copyright (c) 2009, Secure Endpoints Inc.
       4             :  * All rights reserved.
       5             :  *
       6             :  * Redistribution and use in source and binary forms, with or without
       7             :  * modification, are permitted provided that the following conditions
       8             :  * are met:
       9             :  *
      10             :  * - Redistributions of source code must retain the above copyright
      11             :  *   notice, this list of conditions and the following disclaimer.
      12             :  *
      13             :  * - Redistributions in binary form must reproduce the above copyright
      14             :  *   notice, this list of conditions and the following disclaimer in
      15             :  *   the documentation and/or other materials provided with the
      16             :  *   distribution.
      17             :  *
      18             :  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
      19             :  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
      20             :  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
      21             :  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
      22             :  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
      23             :  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
      24             :  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      25             :  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
      26             :  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
      27             :  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
      28             :  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
      29             :  * OF THE POSSIBILITY OF SUCH DAMAGE.
      30             :  *
      31             :  **********************************************************************/
      32             : 
      33             : #include "krb5_locl.h"
      34             : 
      35             : #include <stdarg.h>
      36             : 
      37             : /**
      38             :  * Internal function to expand tokens in paths.
      39             :  *
      40             :  * Inputs:
      41             :  *
      42             :  * @context   A krb5_context
      43             :  * @path_in   The path to expand tokens from
      44             :  * @filepath  True if the value is a filesystem path (converts slashes to
      45             :  *            backslashes on Windows)
      46             :  * @ppath_out The expanded path
      47             :  * 
      48             :  * Outputs:
      49             :  *
      50             :  * @ppath_out Path with expanded tokens (caller must free() this)
      51             :  */
      52             : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
      53      313595 : _krb5_expand_path_tokens(krb5_context context,
      54             :                          const char *path_in,
      55             :                          int filepath,
      56             :                          char **ppath_out)
      57             : {
      58      313595 :     return heim_expand_path_tokens(context ? context->hcontext : NULL, path_in,
      59             :                                    filepath, ppath_out, NULL);
      60             : }
      61             : 
      62             : /**
      63             :  * Internal function to expand tokens in paths.
      64             :  *
      65             :  * Inputs:
      66             :  *
      67             :  * @context   A krb5_context
      68             :  * @path_in   The path to expand tokens from
      69             :  * @filepath  True if the value is a filesystem path (converts slashes to
      70             :  *            backslashes on Windows)
      71             :  * @ppath_out The expanded path
      72             :  * @...       Variable number of pairs of strings, the first of each
      73             :  *            being a token (e.g., "luser") and the second a string to
      74             :  *            replace it with.  The list is terminated by a NULL.
      75             :  * 
      76             :  * Outputs:
      77             :  *
      78             :  * @ppath_out Path with expanded tokens (caller must free() this)
      79             :  */
      80             : KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
      81           0 : _krb5_expand_path_tokensv(krb5_context context,
      82             :                           const char *path_in,
      83             :                           int filepath,
      84             :                           char **ppath_out, ...)
      85             : {
      86           0 :     krb5_error_code ret;
      87           0 :     va_list ap;
      88             : 
      89           0 :     va_start(ap, ppath_out);
      90           0 :     ret = heim_expand_path_tokensv(context->hcontext, path_in, filepath, ppath_out, ap);
      91           0 :     va_end(ap);
      92             : 
      93           0 :     return ret;
      94             : }

Generated by: LCOV version 1.14