zuluCrypt  5.7.1
About: zuluCrypt is a simple but feature rich solution for hard drives encryption. It can manage PLAIN dm-crypt, LUKS, TrueCrypt and VeraCrypt encrypted volumes.
  Fossies Dox: zuluCrypt-5.7.1.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

check_opened_mapper.c
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2012-2015
4  * name : Francis Banyikwa
5  * email: mhogomchungu@gmail.com
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 2 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 #include "includes.h"
20 #include <dirent.h>
21 #include <libcryptsetup.h>
22 
23 int zuluCryptCheckOpenedMapper( const char * mapper )
24 {
25  const char * c = mapper ;
26  char * d ;
27 
28  int st = 0 ;
29 
30  struct dirent * entry ;
31 
32  DIR * dir = opendir( crypt_get_dir() ) ;
33 
34  if( dir == NULL ){
35  return 2 ;
36  }
37 
38  while( *++c != '-' ) { ; }
39  while( *++c != '-' ) { ; }
40 
41  while( ( entry = readdir( dir ) ) != NULL ){
42 
43  d = strstr( entry->d_name,"zuluCrypt-" ) ;
44 
45  if( d != NULL ){
46 
47  while( *++d != '-' ) { ; }
48  while( *++d != '-' ) { ; }
49 
50  if( StringsAreEqual( c,d ) ){
51 
52  st = 1 ;
53  break ;
54  }
55  }
56  }
57 
58  closedir( dir ) ;
59  return st ;
60 }
StringsAreEqual
#define StringsAreEqual(x, y)
Definition: zuluSafe.c:46
zuluCryptCheckOpenedMapper
int zuluCryptCheckOpenedMapper(const char *mapper)
Definition: check_opened_mapper.c:23
includes.h