smbnetfs  0.6.3
About: SMBNetFS is a Linux/FreeBSD filesystem that allow you to use samba/microsoft network in the same manner as the network neighborhood in Microsoft Windows.
  Fossies Dox: smbnetfs-0.6.3.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

auth.c File Reference
#include "config.h"
#include <pwd.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include "list.h"
#include "common.h"
#include "auth-libsecret.h"
#include "auth.h"
Include dependency graph for auth.c:

Go to the source code of this file.

Data Structures

struct  authitem
 

Functions

void auth_set_default_login_name (const char *name)
 
static struct authinfoauthinfo_create_new (const char *domain, const char *user, const char *password)
 
static void authinfo_delete (struct authinfo *info)
 
static int authinfo_compare (struct authinfo *info, const char *domain, const char *user, const char *password)
 
static struct authinfoauthinfo_find_in_list (const char *domain, const char *user, const char *password)
 
static struct authinfoauthinfo_store_list (const char *domain, const char *user, const char *password)
 
static void authinfo_release (struct authinfo *info)
 
static struct authitemauthitem_create_item (const char *name)
 
static void authitem_delete_item (struct authitem *item)
 
static void authitem_delete_obsolete_items (struct authitem *item, time_t threshold)
 
static int authitem_find_subitem (struct authitem *item, const char *name)
 
static int authitem_insert_subitem (struct authitem *item, struct authitem *subitem, int pos)
 
static struct authitemauthitem_get_subitem (struct authitem *item, const char *name)
 
struct authinfoauth_get_authinfo (const char *domain, const char *server, const char *share, int *suitability)
 
void auth_release_authinfo (struct authinfo *info)
 
int auth_store_auth_data (const char *server, const char *share, const char *domain, const char *user, const char *password)
 
void auth_delete_obsolete (time_t threshold)
 

Variables

static char auth_login [64] = "guest"
 
static char * auth_fake_password = "********"
 
static struct authinfo authinfo_default = {{NULL, NULL}, 1, "", auth_login, ""}
 
static LIST authinfo_list = { &( authinfo_list ), &( authinfo_list ) }
 
static struct authitem authroot = {NULL, (time_t) 0, NULL, {0, 0, NULL}}
 
static pthread_mutex_t m_auth = PTHREAD_MUTEX_INITIALIZER
 

Function Documentation

◆ auth_delete_obsolete()

void auth_delete_obsolete ( time_t  threshold)

Definition at line 355 of file auth.c.

References authitem_delete_obsolete_items(), authroot, and m_auth.

Referenced by event_reread_config(), and main().

◆ auth_get_authinfo()

struct authinfo* auth_get_authinfo ( const char *  domain,
const char *  server,
const char *  share,
int *  suitability 
)

◆ auth_release_authinfo()

void auth_release_authinfo ( struct authinfo info)

Definition at line 303 of file auth.c.

References authinfo_release(), and m_auth.

Referenced by smb_conn_send_password().

◆ auth_set_default_login_name()

void auth_set_default_login_name ( const char *  name)

Definition at line 31 of file auth.c.

References auth_login, DPRINTF, and authitem::name.

Referenced by reconfigure_set_default_login_and_configdir().

◆ auth_store_auth_data()

int auth_store_auth_data ( const char *  server,
const char *  share,
const char *  domain,
const char *  user,
const char *  password 
)

◆ authinfo_compare()

static int authinfo_compare ( struct authinfo info,
const char *  domain,
const char *  user,
const char *  password 
)
inlinestatic

Definition at line 65 of file auth.c.

References authinfo::domain, authinfo::password, and authinfo::user.

Referenced by auth_store_auth_data(), and authinfo_find_in_list().

◆ authinfo_create_new()

static struct authinfo* authinfo_create_new ( const char *  domain,
const char *  user,
const char *  password 
)
static

Definition at line 37 of file auth.c.

References authinfo::domain, authinfo::password, and authinfo::user.

Referenced by authinfo_store_list().

◆ authinfo_delete()

static void authinfo_delete ( struct authinfo info)
inlinestatic

Definition at line 61 of file auth.c.

Referenced by authinfo_release().

◆ authinfo_find_in_list()

static struct authinfo* authinfo_find_in_list ( const char *  domain,
const char *  user,
const char *  password 
)
static

◆ authinfo_release()

static void authinfo_release ( struct authinfo info)
static

◆ authinfo_store_list()

static struct authinfo* authinfo_store_list ( const char *  domain,
const char *  user,
const char *  password 
)
static

◆ authitem_create_item()

static struct authitem* authitem_create_item ( const char *  name)
static

Definition at line 122 of file auth.c.

References authitem::name, and authitem::touch_time.

Referenced by authitem_get_subitem().

◆ authitem_delete_item()

static void authitem_delete_item ( struct authitem item)
inlinestatic

Definition at line 135 of file auth.c.

References authinfo_release(), authitem::childs, and authitem::info.

Referenced by authitem_delete_obsolete_items(), and authitem_get_subitem().

◆ authitem_delete_obsolete_items()

static void authitem_delete_obsolete_items ( struct authitem item,
time_t  threshold 
)
static

◆ authitem_find_subitem()

static int authitem_find_subitem ( struct authitem item,
const char *  name 
)
static

Definition at line 178 of file auth.c.

References authitem::child_cnt, authitem::childs, and authitem::name.

Referenced by auth_get_authinfo(), and authitem_get_subitem().

◆ authitem_get_subitem()

static struct authitem* authitem_get_subitem ( struct authitem item,
const char *  name 
)
static

◆ authitem_insert_subitem()

static int authitem_insert_subitem ( struct authitem item,
struct authitem subitem,
int  pos 
)
static

Definition at line 200 of file auth.c.

References authitem::child_cnt, authitem::childs, and authitem::max_child_cnt.

Referenced by authitem_get_subitem().

Variable Documentation

◆ auth_fake_password

char* auth_fake_password = "********"
static

Definition at line 24 of file auth.c.

Referenced by auth_get_authinfo(), auth_store_auth_data(), and authinfo_store_list().

◆ auth_login

char auth_login[64] = "guest"
static

Definition at line 23 of file auth.c.

Referenced by auth_set_default_login_name().

◆ authinfo_default

struct authinfo authinfo_default = {{NULL, NULL}, 1, "", auth_login, ""}
static

Definition at line 24 of file auth.c.

Referenced by auth_get_authinfo().

◆ authinfo_list

LIST authinfo_list = { &( authinfo_list ), &( authinfo_list ) }
static

Definition at line 26 of file auth.c.

Referenced by authinfo_find_in_list(), authinfo_release(), and authinfo_store_list().

◆ authroot

struct authitem authroot = {NULL, (time_t) 0, NULL, {0, 0, NULL}}
static

Definition at line 26 of file auth.c.

Referenced by auth_delete_obsolete(), auth_get_authinfo(), and auth_store_auth_data().

◆ m_auth

pthread_mutex_t m_auth = PTHREAD_MUTEX_INITIALIZER
static