Esempio n. 1
0
static stringList_t _get_mount_entries( const char * device )
{
	/*
	 * zuluCryptGetMountEntry() is defined in mountinfo.c
	 */
	stringList_t stl = zuluCryptGetMoutedList() ;

	StringListIterator it ;
	StringListIterator end ;

	string_t st = String_1( device," ",NULL ) ;

	StringListGetIterators( stl,&it,&end ) ;

	while( it != end ){

		if( StringStartsWith_1( *it,st ) ){

			it++ ;
		}else{
			StringListRemoveAt_1( stl,it,&end ) ;
		}
	}

	StringDelete( &st ) ;

	return stl ;
}
Esempio n. 2
0
string_t zuluCryptGetMountEntry( const char * path )
{
    stringList_t stl = zuluCryptGetMoutedList() ;
    string_t st = zuluCryptGetMountEntry_1( stl,path ) ;
    StringListDelete( &stl ) ;
    return st ;
}
Esempio n. 3
0
static int _mounted( ssize_t( *function )( stringList_t,const char * ),string_t st )
{
    stringList_t stl = zuluCryptGetMoutedList() ;

    ssize_t r = function( stl,StringContent( st ) ) ;

    StringListDelete( &stl ) ;

    StringDelete( &st ) ;

    return r != -1 ;
}
Esempio n. 4
0
static void _zuluCryptPrintUnMountedPartitionProperties( stringList_t stl )
{
	/*
	 * zuluCryptGetMoutedList() is defined in ../lib/process_mountinfo.c
	 */
	stringList_t stx = zuluCryptGetMoutedList() ;

	StringListIterator it  ;
	StringListIterator end ;

	string_t st ;

	StringListGetIterators( stl,&it,&end ) ;

	while( it != end ){
		st = *it ;
		it++ ;
		if( StringListHasStartSequence( stx,StringAppend( st," " ) ) == -1 ){
			zuluCryptPrintPartitionProperties( StringRemoveRight( st,1 ) ) ;
		}
	}

	StringListDelete( &stx ) ;
}
Esempio n. 5
0
stringList_t zuluCryptOpenedVolumesList( uid_t uid )
{
    const char * e ;
    const char * c ;
    const char * d ;
    const char * t ;

    char * f ;
    char * g ;

    StringListIterator it  ;
    StringListIterator end ;

    ssize_t k ;

    string_t q ;
    string_t z ;

    string_t j ;

    stringList_t stx ;
    stringList_t list = StringListVoid ;
    stringList_t stl = zuluCryptGetMoutedList() ;

    if( uid ) {
        ;
    }

    /*
     * zuluCryptMapperPrefix() is defined in create_mapper_name.c
     */
    j = String_1( zuluCryptMapperPrefix(),"/zuluCrypt-",NULL ) ;
    /*
     * t will probably contain "/dev/mapper/zuluCrypt-"
     */
    t = StringContent( j ) ;

    StringListGetIterators( stl,&it,&end ) ;

    while( it != end ) {

        c = StringContent( *it ) ;

        it++ ;

        if( StringPrefixNotEqual( c,t ) ) {

            /*
             * we only care about zuluCrypt volumes and these volumes that we care about starts with
             * "/dev/mapper/zuluCrypt-"
             */

            continue ;
        }
        if( StringHasComponent( c,"/run/media/public/" ) ) {

            /*
             * dont show mirror images due to bind mounts
             */

            continue ;
        }

        stx = StringListSplit( c,' ' ) ;

        e = StringListContentAtFirstPlace( stx ) ;

        k = StringHasComponent_1( e,"-UUID-" ) ;

        if( k != -1 ) {

            q = StringListStringAtFirstPlace( stx ) ;
            /*
             * zuluCryptDecodeMountEntry() is defined in mount_volume.c
             */
            d = zuluCryptDecodeMountEntry( StringListStringAtSecondPlace( stx ) ) ;

            /*
             * zuluCryptGetVolumeTypeFromMapperPath() is defined in status.c
             */
            f = zuluCryptGetVolumeTypeFromMapperPath( StringContent( q ) ) ;
            e = StringSubChar( q,StringLastIndexOfChar( q,'-' ),'\0' ) + k + 6 ;
            z = String_1( "UUID=\"",e,"\"\t",d,"\t",f,NULL ) ;
            list = StringListAppendString_1( list,&z ) ;
            StringFree( f ) ;
        } else {
            /*
             * zuluCryptVolumeDeviceName() is defined in status.c
             */
            g = zuluCryptVolumeDeviceName( e ) ;

            if( g != NULL ) {

                d = zuluCryptDecodeMountEntry( StringListStringAtSecondPlace( stx ) ) ;
                /*
                 * zuluCryptGetVolumeTypeFromMapperPath() is defined in status.c
                 */
                f = zuluCryptGetVolumeTypeFromMapperPath( StringListContentAtFirstPlace( stx ) ) ;
                z = String_1( g,"\t",d,"\t",f,NULL ) ;
                list = StringListAppendString_1( list,&z ) ;
                StringFree( f ) ;
                StringFree( g ) ;
            }
        }

        StringListDelete( &stx ) ;
    }
    StringListDelete( &stl ) ;
    StringDelete( &j ) ;
    return list ;
}