PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/zuluCrypt-cli/bin/includes.h

https://gitlab.com/m.schmidt/zuluCrypt
C Header | 272 lines | 64 code | 53 blank | 155 comment | 0 complexity | 4e1cac33ddcf4b6a0e7e8361a1863010 MD5 | raw file
Possible License(s): BSD-3-Clause-No-Nuclear-License-2014, BSD-2-Clause
  1. /*
  2. *
  3. * Copyright (c) 2011-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. #ifndef ZULUCRYPT_BIN
  20. #define ZULUCRYPT_BIN
  21. #define STRING_MEMORY_HACK 1
  22. #include "../utility/string/String.h"
  23. #include "../utility/string/StringList.h"
  24. #include "../constants.h"
  25. #include "../lib/libzuluCrypt.h"
  26. #include "../utility/socket/socket.h"
  27. #include "../utility/process/process.h"
  28. #include "libzuluCrypt-exe.h"
  29. #include "security.h"
  30. #include "locale_path.h"
  31. #include "../lib/includes.h"
  32. typedef struct{
  33. int iteration_count ;
  34. string_t type ;
  35. }tvcrypt ;
  36. /*
  37. * these two defines are used in save_and_restore_volume_header.c
  38. */
  39. #define VOLUME_HEADER_RESTORE 1
  40. #define VOLUME_HEADER_SAVE 0
  41. /*
  42. * These functions are here and not in libzuluCrypt-exe.h because they use string_t and the type is not supposed to be
  43. * seen in public API
  44. */
  45. /*
  46. * global_variable_user_uid global variable is defined in security.c
  47. */
  48. extern uid_t global_variable_user_uid ;
  49. /*
  50. * zuluCryptTrueCryptVeraCryptVolumeInfo() is defined in open_volume.c
  51. */
  52. void zuluCryptTrueCryptVeraCryptVolumeInfo( const char * type,tvcrypt * e ) ;
  53. /*
  54. * this function is defined in security.c
  55. */
  56. int zuluCryptSecurityConvertUID( uid_t uid,const char * u_id ) ;
  57. /*
  58. * this function is defined in volumes.c
  59. */
  60. int zuluCryptVolumeIsInSystemVolumeList( const char * device ) ;
  61. /*
  62. * this function is defined in open_volume.c
  63. */
  64. stringList_t zuluCryptCreateKeyFiles( const char * const * list,int s ) ;
  65. /*
  66. * this function is defined in open_volume.c
  67. */
  68. void zuluCryptDeleteKeyFiles( stringList_t stl ) ;
  69. /*
  70. * this function is defined in module_system.c
  71. * It gets a passphrase from a .so file as a plugin.
  72. */
  73. string_t GetKeyFromModule( const char * path,uid_t ) ;
  74. /*
  75. * this function is defined in get_key_from_socket.c
  76. */
  77. void zuluCryptGetKeyFromSocket( const char * path,string_t *,uid_t uid ) ;
  78. /*
  79. * this function returns "$HOME/" and is defined in ../pluginManager/zuluCryptPluginManager.c
  80. */
  81. string_t zuluCryptGetUserHomePath( uid_t ) ;
  82. /*
  83. * this function is defined in volumes.c
  84. */
  85. int zuluCryptPartitionIsSystemPartition( const char * dev,uid_t uid ) ;
  86. /*
  87. * this function is defined in is_luks.c
  88. */
  89. int zuluCryptVolumeIsNotLuks( const char * dev ) ;
  90. /*
  91. * this function is defined in volumes.c
  92. */
  93. int zuluCryptPrintDeviceProperties( int type ) ;
  94. /*
  95. * this function is defined in security.c
  96. */
  97. int zuluCryptSecurityCheckPartitionPermissions( uid_t uid ) ;
  98. /*
  99. * this function is defined in volumes.c
  100. */
  101. char * zuluCryptDeviceFromLabel( const char * label ) ;
  102. /*
  103. * this function is defined in security.c
  104. */
  105. int zuluCryptSecurityPathIsValid( const char * path,uid_t uid ) ;
  106. /*
  107. * this function is defined in get_opts.c
  108. */
  109. void zuluCryptEXEGetOptsSetDefault( struct_opts * stopts ) ;
  110. /*
  111. * this function is defined in mount_flags.c
  112. */
  113. int zuluCryptMountFlagsAreNotCorrect( const char * mode,uid_t uid,unsigned long * flags ) ;
  114. /*
  115. * this function is defined in security.c
  116. */
  117. int zuluCryptSecurityGainElevatedPrivileges( void ) ;
  118. /*
  119. * this function is defined in security.c
  120. */
  121. int zuluCryptSecurityDropElevatedPrivileges( void ) ;
  122. /*
  123. * this function is defined in security.c
  124. */
  125. string_t zuluCryptSecurityGetFileSystemFromDevice( const char * path ) ;
  126. /*
  127. * this function is defined in real_path.c
  128. */
  129. int zuluCryptPathStartsWith( const char * path,const char * start ) ;
  130. /*
  131. * this function is defined in real_path.c
  132. */
  133. int zuluCryptPathDoesNotStartsWith( const char * path,const char * start ) ;
  134. /*
  135. * this function is defined in mount_fs_options.c
  136. */
  137. int zulucryptFileSystemIsNotSupported( const char * fs ) ;
  138. /*
  139. * this function is defined in ../lib/real_path.c
  140. */
  141. char * zuluCryptRealPath( const char * path ) ;
  142. /*
  143. * this function is defined in clear_dead_mapper.c
  144. */
  145. void zuluCryptClearDeadMappers( uid_t uid ) ;
  146. /*
  147. * this function is defined in save_and_restore_luks_header.c
  148. */
  149. int zuluCryptHeaderMatchBackUpHeader( const char * device,const char * header_backup,uid_t uid ) ;
  150. /*
  151. * this function is defined in bind.c
  152. */
  153. int zuluCryptBindUnmountVolume( stringList_t mountinfo,const char * device,uid_t uid ) ;
  154. /*
  155. * this function is defined in bind.c
  156. */
  157. int zuluCryptBindMountVolume( const char * device,string_t,unsigned long flags ) ;
  158. /*
  159. * this function is defined in bind.c
  160. */
  161. int zuluCryptBindSharedMountPointPathTaken( string_t path ) ;
  162. /*
  163. * this function is defined in ../pluginManager/zuluCryptPluginManager.c
  164. */
  165. string_t zuluCryptPluginManagerGetKeyFromModule( const char * device,const char * name,
  166. const char * uuid,uid_t uid,const struct_opts * opts,int * r ) ;
  167. /*
  168. * this function is defined in volumes.c
  169. */
  170. stringList_t zuluCryptGetPartitionFromCrypttab( void ) ;
  171. /*
  172. * this function is defined in volumes.c
  173. */
  174. stringList_t zuluCryptGetPartitionFromConfigFile( const char * path ) ;
  175. /*
  176. * this function is defined in volumes.c
  177. */
  178. stringList_t zuluCryptPartitionList( void ) ;
  179. /*
  180. * this function is defined in create_mount_point.c
  181. */
  182. string_t zuluCryptCreateMountPoint( const char * device,const char * m_point,const char * m_opts,uid_t uid ) ;
  183. /*
  184. * this function is defined in create_mount_point.c
  185. */
  186. int zuluCryptMountPointPrefixMatch( const char * path,uid_t uid,string_t * m_point ) ;
  187. /*
  188. * this function is defined in path_access.c
  189. */
  190. int zuluCryptGetPassFromFile( const char * path,uid_t uid,string_t * st ) ;
  191. /*
  192. * this function is defined in path_access.c
  193. */
  194. char * zuluCryptUUIDFromPath( const char * device ) ;
  195. /*
  196. * this function is defined in path_access.c
  197. */
  198. char * zuluCryptEvaluateDeviceTags( const char * tag,const char * path ) ;
  199. /*
  200. * zuluCryptRunTest() is defined in test.c
  201. */
  202. int zuluCryptRunTest( void ) ;
  203. /*
  204. * zuluCryptDeviceIsSupported() is defined in volumes.c
  205. */
  206. int zuluCryptDeviceIsSupported( const char * device,uid_t uid ) ;
  207. /*
  208. * zuluCryptPartitions() is defined in volumes.c
  209. */
  210. stringList_t zuluCryptPartitions( int option,uid_t uid ) ;
  211. /*
  212. * zuluCryptGetVolumeSize() is defined in volumes.c
  213. */
  214. u_int64_t zuluCryptGetVolumeSize( const char * device ) ;
  215. /*
  216. * zuluCryptGetAListOfAllPartitions() is defined in volumes.c
  217. */
  218. stringList_t zuluCryptGetAListOfAllVolumes( void ) ;
  219. #endif