1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
|
/*
*
* Copyright (c) 2011-2015
* name : Francis Banyikwa
* email: mhogomchungu@gmail.com
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ZULUCRYPT_BIN
#define ZULUCRYPT_BIN
#define STRING_MEMORY_HACK 1
#include "../utility/string/String.h"
#include "../utility/string/StringList.h"
#include "../constants.h"
#include "../lib/libzuluCrypt.h"
#include "../utility/socket/socket.h"
#include "../utility/process/process.h"
#include "libzuluCrypt-exe.h"
#include "security.h"
#include "locale_path.h"
#include "../lib/includes.h"
typedef struct{
int iteration_count ;
string_t type ;
}tvcrypt ;
/*
* these two defines are used in save_and_restore_volume_header.c
*/
#define VOLUME_HEADER_RESTORE 1
#define VOLUME_HEADER_SAVE 0
/*
* These functions are here and not in libzuluCrypt-exe.h because they use string_t and the type is not supposed to be
* seen in public API
*/
/*
* global_variable_user_uid global variable is defined in security.c
*/
extern uid_t global_variable_user_uid ;
/*
* zuluCryptTrueCryptVeraCryptVolumeInfo() is defined in open_volume.c
*/
void zuluCryptTrueCryptVeraCryptVolumeInfo( const char * type,tvcrypt * e ) ;
/*
* this function is defined in security.c
*/
int zuluCryptSecurityConvertUID( uid_t uid,const char * u_id ) ;
/*
* this function is defined in volumes.c
*/
int zuluCryptVolumeIsInSystemVolumeList( const char * device ) ;
/*
* this function is defined in path_access.c
*/
void zuluCryptPrepareSocketPath( uid_t uid ) ;
/*
* this function is defined in open_volume.c
*/
stringList_t zuluCryptCreateKeyFiles( const char * const * list,int s ) ;
/*
* this function is defined in save_and_restore_volume_header.c
*/
stringList_t veraCryptVolumePIMValue( info_t * s,const char * type ) ;
/*
* this function is defined in open_volume.c
*/
void zuluCryptDeleteKeyFiles( stringList_t stl ) ;
/*
* this function is defined in module_system.c
* It gets a passphrase from a .so file as a plugin.
*/
string_t GetKeyFromModule( const char * path,uid_t ) ;
/*
* this function is defined in get_key_from_socket.c
*/
void zuluCryptGetKeyFromSocket( const char * path,string_t *,uid_t uid ) ;
/*
* this function returns "$HOME/" and is defined in ../pluginManager/zuluCryptPluginManager.c
*/
string_t zuluCryptGetUserHomePath( uid_t ) ;
/*
* this function is defined in volumes.c
*/
int zuluCryptPartitionIsSystemPartition( const char * dev,uid_t uid ) ;
/*
* this function is defined in is_luks.c
*/
int zuluCryptVolumeIsNotLuks( const char * dev ) ;
/*
* this function is defined in volumes.c
*/
int zuluCryptPrintDeviceProperties( int type ) ;
/*
* this function is defined in volumes.c
*/
const char * zuluCryptVolumeType( blkid_probe blkid,const char * device ) ;
/*
* this function is defined in security.c
*/
int zuluCryptSecurityCheckPartitionPermissions( uid_t uid ) ;
/*
* this function is defined in volumes.c
*/
char * zuluCryptDeviceFromLabel( const char * label ) ;
/*
* this function is defined in security.c
*/
int zuluCryptSecurityPathIsValid( const char * path,uid_t uid ) ;
/*
* this function is defined in get_opts.c
*/
void zuluCryptEXEGetOptsSetDefault( struct_opts * stopts ) ;
/*
* this function is defined in mount_flags.c
*/
int zuluCryptMountFlagsAreNotCorrect( const char * mode,uid_t uid,unsigned long * flags ) ;
/*
* this function is defined in security.c
*/
int zuluCryptSecurityGainElevatedPrivileges( void ) ;
/*
* this function is defined in security.c
*/
int zuluCryptSecurityDropElevatedPrivileges( void ) ;
/*
* this function is defined in security.c
*/
string_t zuluCryptSecurityGetFileSystemFromDevice( const char * path ) ;
/*
* this function is defined in real_path.c
*/
int zuluCryptPathStartsWith( const char * path,const char * start ) ;
/*
* this function is defined in real_path.c
*/
int zuluCryptPathDoesNotStartsWith( const char * path,const char * start ) ;
/*
* this function is defined in mount_fs_options.c
*/
int zulucryptFileSystemIsNotSupported( const char * fs ) ;
/*
* this function is defined in ../lib/real_path.c
*/
char * zuluCryptRealPath( const char * path ) ;
/*
* this function is defined in clear_dead_mapper.c
*/
void zuluCryptClearDeadMappers( uid_t uid,int ) ;
/*
* this function is defined in clear_dead_mapper.c
*/
void zuluCryptDeleteDeadMountPoints( uid_t,stringList_t ) ;
/*
* this function is defined in save_and_restore_luks_header.c
*/
int zuluCryptHeaderMatchBackUpHeader( const char * device,const char * header_backup,uid_t uid ) ;
/*
* this function is defined in bind.c
*/
int zuluCryptBindUnmountVolume( stringList_t mountinfo,const char * device,uid_t uid ) ;
/*
* this function is defined in bind.c
*/
int zuluCryptBindMountVolume( const char * device,string_t,unsigned long flags ) ;
/*
* this function is defined in bind.c
*/
int zuluCryptBindSharedMountPointPathTaken( string_t path ) ;
/*
* this function is defined in ../pluginManager/zuluCryptPluginManager.c
*/
string_t zuluCryptPluginManagerGetKeyFromModule( const char * device,
const char * name,
const char * uuid,
uid_t uid,
const struct_opts * opts,
const char * run_path,
int * r ) ;
/*
* this function is defined in volumes.c
*/
stringList_t zuluCryptGetPartitionFromCrypttab( void ) ;
/*
* this function is defined in volumes.c
*/
stringList_t zuluCryptGetPartitionFromConfigFile( const char * path ) ;
/*
* this function is defined in volumes.c
*/
stringList_t zuluCryptPartitionList( void ) ;
/*
* this function is defined in create_mount_point.c
*/
string_t zuluCryptCreateMountPoint( const char * device,const char * m_point,const char * m_opts,uid_t uid ) ;
/*
* this function is defined in create_mount_point.c
*/
void zuluCryptCreateMountPointPrefix( uid_t uid ) ;
/*
* zuluCryptCreateMountPath() is defined in create_mount_point.c
*/
void zuluCryptCreateMountPath( const char * path ) ;
/*
* this function is defined in create_mount_point.c
*/
int zuluCryptMountPointPrefixMatch( const char * path,uid_t uid,string_t * m_point ) ;
/*
* this function is defined in path_access.c
*/
int zuluCryptGetPassFromFile( int * socket_path,const char * path,uid_t uid,string_t * st ) ;
/*
* this function is defined in path_access.c
*/
char * zuluCryptUUIDFromPath( const char * device ) ;
/*
* this function is defined in path_access.c
*/
char * zuluCryptEvaluateDeviceTags( const char * tag,const char * path ) ;
/*
* zuluCryptRunTest() is defined in test.c
*/
int zuluCryptRunTest( void ) ;
/*
* zuluCryptDeviceIsSupported() is defined in volumes.c
*/
int zuluCryptDeviceIsSupported( const char * device,uid_t uid ) ;
/*
* zuluCryptPartitions() is defined in volumes.c
*/
stringList_t zuluCryptPartitions( int option,uid_t uid ) ;
/*
* zuluCryptGetVolumeSize() is defined in volumes.c
*/
u_int64_t zuluCryptGetVolumeSize( const char * device ) ;
/*
* zuluCryptGetAListOfAllPartitions() is defined in volumes.c
*/
stringList_t zuluCryptGetAListOfAllVolumes( void ) ;
/*
* zuluCryptReuseMountPoint() is defined in create_mount_point.c
*/
int zuluCryptReuseMountPoint( void ) ;
#endif
|