/*
SSSD
authtok - Utilities tests
Authors:
Pallavi Jha <pallavikumarijha@gmail.com>
Copyright (C) 2013 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 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/>.
*/
#include <string.h>
#include <popt.h>
#include "tests/cmocka/common_mock.h"
struct test_state {
};
{
return 0;
}
{
return 0;
}
{
}
/* @test_authtok_type_x : tests following functions for different value of type
* sss_authtok_set
* sss_authtok_get_type
* sss_authtok_get_size
* sss_authtok_get_data
* sss_authtok_get_password
* sss_authtok_get_ccfile
*
* @test_authtok_type_password : type => SSS_AUTHTOK_TYPE_PASSWORD
* @test_authtok_type_ccfile : type => SSS_AUTHTOK_TYPE_CCFILE
* @test_authtok_type_empty : type => SSS_AUTHTOK_TYPE_EMPTY
*/
/* Test when type has value SSS_AUTHTOK_TYPE_PASSWORD */
{
char *data;
const char *pwd;
}
/* Test when type has value SSS_AUTHTOK_TYPE_CCFILE */
{
char *data;
const char *pwd;
}
/* Test when type has value SSS_AUTHTOK_TYPE_EMPTY */
{
const char *pwd;
}
{
char *data;
const char *pwd;
}
{
char *data;
}
{
int ret;
const char *fa1;
const char *fa2;
/* Test missing first factor */
/* Test missing second factor */
/* Test wrong first factor length */
/* Test wrong second factor length */
#if __BYTE_ORDER == __LITTLE_ENDIAN
"\2\0\0\0\3\0\0\0a\0bc\0",
#else
"\0\0\0\2\0\0\0\3a\0bc\0",
#endif
/* check return code of empty token */
/* check return code for other token type */
/* check return code for garbage */
}
{
int ret;
char *fa1;
char *fa2;
&needed_size);
#if __BYTE_ORDER == __LITTLE_ENDIAN
#else
#endif
&fa2_len);
}
#define MISSING_NULL_CHECK do { \
\
talloc_free(fa1); \
talloc_free(fa2); \
} while (0)
{
int ret;
char *fa1;
char *fa2;
#if __BYTE_ORDER == __LITTLE_ENDIAN
uint8_t b0[] = {0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 'a', 'b', 'c', 0x00, 'd', 'e', 'f', 'g', 0x00};
uint8_t b1[] = {0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 0x00};
uint8_t b2[] = {0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 'a', 'b', 'c', 0x00, 'd', 'e', 'f', 'g'};
#else
uint8_t b0[] = {0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 'a', 'b', 'c', 0x00, 'd', 'e', 'f', 'g', 0x00};
uint8_t b1[] = {0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 0x00};
uint8_t b2[] = {0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 'a', 'b', 'c', 0x00, 'd', 'e', 'f', 'g'};
#endif
&fa2_len);
&fa2_len);
&fa2_len);
&fa2_len);
}
{
}
{
int ret;
const char *pin;
size);
size);
}
{
int opt;
};
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
}