Пример #1
0
BOOL _input_verify(
		dc_pass *pass,
		dc_pass *verify,
		int      keyfiles_list,
		int      kb_layout,
		int     *msg_idx
	)
{
	BOOL correct = FALSE;

	_pass_inf info;
	_check_password( pass, &info );

	*msg_idx = ST_PASS_CORRRECT;
	if ( info.length )
	{		
		if ( (kb_layout == KB_QWERTY && info.flags & P_NCHAR) || 
			 ((kb_layout == KB_QWERTZ || kb_layout == KB_AZERTY) && 
			 (info.flags & P_NCHAR || info.flags & P_SPCH))) 
		{
				 
			*msg_idx = ST_PASS_SPRS_SYMBOLS;
		} else {
			correct = TRUE;
		}
	} else {
		*msg_idx = ST_PASS_EMPTY;
	}

	if ( correct && verify != NULL )
	{
		if ( !IS_EQUAL_PASS(pass, verify) )
		{
			*msg_idx = ST_PASS_NOT_CONFIRMED;
		}
		if ( verify->size == 0 ) 
		{
			*msg_idx = ST_PASS_EMPTY_CONFIRM;
		}		
	} else
	{
		if ( keyfiles_list != KEYLIST_NONE )
		{
			if ( _keyfiles_count(keyfiles_list) == 0 )
			{
				*msg_idx = ST_PASS_EMPTY_KEYLIST;
			}
		}
	}
	return (
		(  info.length && !verify ) || 
		(  info.length &&  verify && IS_EQUAL_PASS(pass, verify) ) || 
		( !info.length && _keyfiles_count(keyfiles_list) )
	);

}
Пример #2
0
void dc_add_password(dc_pass *pass)
{
	dsk_pass *d_pass;

	if (pass->size != 0)
	{
		KeEnterCriticalRegion();
		ExAcquireResourceExclusiveLite(&p_resource, TRUE);

		for (d_pass = f_pass; d_pass; d_pass = d_pass->next)
		{
			if (IS_EQUAL_PASS(pass, &d_pass->pass)) {
				break;
			}
		}

		if ( (d_pass == NULL) && (d_pass = mm_secure_alloc(sizeof(dsk_pass))) )
		{
			memcpy(&d_pass->pass, pass, sizeof(dc_pass));

			d_pass->next = f_pass;
			f_pass       = d_pass;
		}

		ExReleaseResourceLite(&p_resource);
		KeLeaveCriticalRegion();
	}
}