LCOV - code coverage report
Current view: top level - source3/lib - util_macstreams.c (source / functions) Hit Total Coverage
Test: coverage report for abartlet/fix-coverage dd10fb34 Lines: 20 20 100.0 %
Date: 2021-09-23 10:06:22 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /*
       2             :    Unix SMB/CIFS implementation.
       3             :    Samba utility functions
       4             :    Copyright (C) Ralph Boehme 2019
       5             : 
       6             :    This program is free software; you can redistribute it and/or modify
       7             :    it under the terms of the GNU General Public License as published by
       8             :    the Free Software Foundation; either version 3 of the License, or
       9             :    (at your option) any later version.
      10             : 
      11             :    This program 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
      14             :    GNU General Public License for more details.
      15             : 
      16             :    You should have received a copy of the GNU General Public License
      17             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      18             : */
      19             : 
      20             : #include "includes.h"
      21             : #include "MacExtensions.h"
      22             : #include "util_macstreams.h"
      23             : 
      24             : /* Yes, I have considered multibyte */
      25             : #undef strncasecmp
      26             : 
      27       24534 : bool is_afpinfo_stream(const char *sname)
      28             : {
      29             :         int cmp;
      30             : 
      31       24534 :         if (sname == NULL) {
      32        4616 :                 return false;
      33             :         }
      34             : 
      35       19918 :         cmp = strncasecmp(sname,
      36             :                           AFPINFO_STREAM_NAME,
      37             :                           strlen(AFPINFO_STREAM_NAME));
      38       19918 :         if (cmp == 0) {
      39       13040 :                 return true;
      40             :         }
      41        6878 :         return false;
      42             : }
      43             : 
      44       11512 : bool is_afpresource_stream(const char *sname)
      45             : {
      46             :         int cmp;
      47             : 
      48       11512 :         if (sname == NULL) {
      49        4616 :                 return false;
      50             :         }
      51             : 
      52        6896 :         cmp = strncasecmp(sname,
      53             :                           AFPRESOURCE_STREAM_NAME,
      54             :                           strlen(AFPRESOURCE_STREAM_NAME));
      55        6896 :         if (cmp == 0) {
      56        3992 :                 return true;
      57             :         }
      58        2904 :         return false;
      59             : }
      60             : 
      61             : /**
      62             :  * Test whether stream is an Apple stream.
      63             :  **/
      64        8204 : bool is_apple_stream(const char *sname)
      65             : {
      66        8204 :         if (is_afpinfo_stream(sname)) {
      67        2794 :                 return true;
      68             :         }
      69        5410 :         if (is_afpresource_stream(sname)) {
      70         750 :                 return true;
      71             :         }
      72        4660 :         return false;
      73             : }

Generated by: LCOV version 1.13