OpenVPN
Functions | Variables
test_user_pass.c File Reference
#include "syshead.h"
#include "manage.h"
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>
#include <cmocka.h>
#include "test_common.h"
#include "misc.c"
Include dependency graph for test_user_pass.c:

Go to the source code of this file.

Functions

bool query_user_exec_builtin (void)
 Executes a configured setup, using the built-in method for querying the user. More...
 
void management_auth_failure (struct management *man, const char *type, const char *reason)
 
bool management_query_user_pass (struct management *man, struct user_pass *up, const char *type, const unsigned int flags, const char *static_challenge)
 
int parse_line (const char *line, char **p, const int n, const char *file, const int line_num, int msglevel, struct gc_arena *gc)
 
static void reset_user_pass (struct user_pass *up)
 
static void test_get_user_pass_defined (void **state)
 
static void test_get_user_pass_needok (void **state)
 
static void test_get_user_pass_inline_creds (void **state)
 
static void test_get_user_pass_authfile_stdin (void **state)
 
static void test_get_user_pass_authfile_file (void **state)
 
static void test_get_user_pass_dynamic_challenge (void **state)
 
static void test_get_user_pass_static_challenge (void **state)
 
int main (void)
 

Variables

struct managementmanagement
 
const struct CMUnitTest user_pass_tests []
 

Function Documentation

◆ main()

int main ( void  )

Definition at line 342 of file test_user_pass.c.

References openvpn_unit_test_setup(), and user_pass_tests.

◆ management_auth_failure()

void management_auth_failure ( struct management man,
const char *  type,
const char *  reason 
)

Definition at line 60 of file test_user_pass.c.

References M_CLIENT, and msg.

◆ management_query_user_pass()

bool management_query_user_pass ( struct management man,
struct user_pass up,
const char *  type,
const unsigned int  flags,
const char *  static_challenge 
)

◆ parse_line()

int parse_line ( const char *  line,
char **  p,
const int  n,
const char *  file,
const int  line_num,
int  msglevel,
struct gc_arena gc 
)

Definition at line 76 of file test_user_pass.c.

◆ query_user_exec_builtin()

bool query_user_exec_builtin ( void  )

Executes a configured setup, using the built-in method for querying the user.

This method uses the console/TTY directly.

Parameters
setupPointer to the setup defining what to ask the user
Returns
True if executing all the defined steps completed successfully

Executes a configured setup, using the built-in method for querying the user.

Default method for querying user using default stdin/stdout on a console. This needs to be available as a backup interface for the alternative implementations in case they cannot query through their implementation specific methods.

If no alternative implementation is declared, a wrapper in console.h will ensure query_user_exec() will call this function instead.

Definition at line 48 of file test_user_pass.c.

References query_user, QUERY_USER_NUMSLOTS, and _query_user::response.

Referenced by query_user_exec(), test_get_user_pass_authfile_file(), test_get_user_pass_authfile_stdin(), test_get_user_pass_dynamic_challenge(), test_get_user_pass_inline_creds(), test_get_user_pass_needok(), and test_get_user_pass_static_challenge().

◆ reset_user_pass()

static void reset_user_pass ( struct user_pass up)
static

◆ test_get_user_pass_authfile_file()

static void test_get_user_pass_authfile_file ( void **  state)
static

◆ test_get_user_pass_authfile_stdin()

static void test_get_user_pass_authfile_stdin ( void **  state)
static

◆ test_get_user_pass_defined()

static void test_get_user_pass_defined ( void **  state)
static

Definition at line 95 of file test_user_pass.c.

References user_pass::defined, get_user_pass_cr(), and reset_user_pass().

◆ test_get_user_pass_dynamic_challenge()

static void test_get_user_pass_dynamic_challenge ( void **  state)
static

◆ test_get_user_pass_inline_creds()

static void test_get_user_pass_inline_creds ( void **  state)
static

◆ test_get_user_pass_needok()

static void test_get_user_pass_needok ( void **  state)
static

◆ test_get_user_pass_static_challenge()

static void test_get_user_pass_static_challenge ( void **  state)
static

Variable Documentation

◆ management

Definition at line 44 of file test_user_pass.c.

◆ user_pass_tests

const struct CMUnitTest user_pass_tests[]
Initial value:
= {
cmocka_unit_test(test_get_user_pass_defined),
cmocka_unit_test(test_get_user_pass_needok),
}

Definition at line 329 of file test_user_pass.c.

Referenced by main().

test_get_user_pass_defined
static void test_get_user_pass_defined(void **state)
Definition: test_user_pass.c:95
test_get_user_pass_inline_creds
static void test_get_user_pass_inline_creds(void **state)
Definition: test_user_pass.c:132
test_get_user_pass_dynamic_challenge
static void test_get_user_pass_dynamic_challenge(void **state)
Definition: test_user_pass.c:274
test_get_user_pass_authfile_stdin
static void test_get_user_pass_authfile_stdin(void **state)
Definition: test_user_pass.c:203
test_get_user_pass_needok
static void test_get_user_pass_needok(void **state)
Definition: test_user_pass.c:104
test_get_user_pass_authfile_file
static void test_get_user_pass_authfile_file(void **state)
Definition: test_user_pass.c:232
test_get_user_pass_static_challenge
static void test_get_user_pass_static_challenge(void **state)
Definition: test_user_pass.c:291