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)  

smb_conn.c File Reference
#include "config.h"
#include <time.h>
#include <errno.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <sys/uio.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <signal.h>
#include <pthread.h>
#include <glib.h>
#include "list.h"
#include "common.h"
#include "smbitem.h"
#include "auth-libsecret.h"
#include "auth.h"
#include "smb_conn_proto.h"
#include "process.h"
#include "smb_conn.h"
#include "neg_cache.h"
Include dependency graph for smb_conn.c:

Go to the source code of this file.

Data Structures

struct  smb_conn_query_result
 

Macros

#define MAP_ANONYMOUS   MAP_ANON
 
#define SMB_CONN_PROCESS_STATE_UNKNOWN   -1
 
#define SMB_CONN_PROCESS_STATE_ALIVE   0
 
#define SMB_CONN_PROCESS_STATE_DIED   1
 

Functions

static int smb_conn_is_neg_cache_candidate (enum smb_conn_cmd query_cmd, struct smb_conn_query_result *result)
 
static int smb_conn_query_result_map (struct smb_conn_query_result *result)
 
static int smb_conn_query_result_check (enum smb_conn_cmd query_cmd, struct smb_conn_query_result *result)
 
int smb_conn_set_max_retry_count (int count)
 
static int smb_conn_get_max_retry_count (void)
 
int smb_conn_set_max_passwd_query_count (int count)
 
static int smb_conn_get_max_passwd_query_count (void)
 
int smb_conn_set_server_reply_timeout (int timeout)
 
static int smb_conn_get_server_reply_timeout (void)
 
static void smb_conn_connection_close (struct smb_conn_ctx *ctx)
 
static int smb_conn_up_if_broken (struct smb_conn_ctx *ctx)
 
int smb_conn_ctx_init (struct smb_conn_ctx *ctx, size_t shmem_size)
 
int smb_conn_ctx_destroy (struct smb_conn_ctx *ctx)
 
static int smb_conn_send_password_base (struct smb_conn_ctx *ctx, const char *domain, const char *user, const char *password)
 
static int smb_conn_send_password (struct smb_conn_ctx *ctx, const char *server, const char *share)
 
static int smb_conn_process_query_lowlevel_va (struct smb_conn_ctx *ctx, enum smb_conn_cmd query_cmd, void *query, size_t query_len, struct smb_conn_query_result *result, void *reply, size_t reply_len, va_list ap)
 
static int smb_conn_process_query_lowlevel (struct smb_conn_ctx *ctx, enum smb_conn_cmd query_cmd, void *query, size_t query_len, struct smb_conn_query_result *result, void *reply, size_t reply_len,...)
 
static int smb_conn_process_query (struct smb_conn_ctx *ctx, enum smb_conn_cmd query_cmd, void *query, size_t query_len, void *reply, size_t reply_len,...)
 
static int smb_conn_process_fd_query (struct smb_conn_ctx *ctx, enum smb_conn_cmd query_cmd, struct smb_conn_file *file, smb_conn_srv_fd *query_fd_ptr, void *query, size_t query_len, void *reply, size_t reply_len)
 
smb_conn_fd smb_conn_open (struct smb_conn_ctx *ctx, const char *url, int flags, mode_t mode)
 
smb_conn_fd smb_conn_creat (struct smb_conn_ctx *ctx, const char *url, mode_t mode)
 
ssize_t smb_conn_read (struct smb_conn_ctx *ctx, smb_conn_fd fd, off_t offset, void *buf, size_t bufsize)
 
ssize_t smb_conn_write (struct smb_conn_ctx *ctx, smb_conn_fd fd, off_t offset, const void *buf, size_t bufsize)
 
int smb_conn_close (struct smb_conn_ctx *ctx, smb_conn_fd fd)
 
int smb_conn_unlink (struct smb_conn_ctx *ctx, const char *url)
 
int smb_conn_rename (struct smb_conn_ctx *ctx, const char *old_url, const char *new_url)
 
smb_conn_fd smb_conn_opendir (struct smb_conn_ctx *ctx, const char *url)
 
int smb_conn_closedir (struct smb_conn_ctx *ctx, smb_conn_fd fd)
 
ssize_t smb_conn_readdir (struct smb_conn_ctx *ctx, smb_conn_fd fd, void *buf, size_t bufsize)
 
int smb_conn_mkdir (struct smb_conn_ctx *ctx, const char *url, mode_t mode)
 
int smb_conn_rmdir (struct smb_conn_ctx *ctx, const char *url)
 
int smb_conn_stat (struct smb_conn_ctx *ctx, const char *url, struct stat *st)
 
int smb_conn_fstat (struct smb_conn_ctx *ctx, smb_conn_fd fd, struct stat *st)
 
int smb_conn_ftruncate (struct smb_conn_ctx *ctx, smb_conn_fd fd, off_t size)
 
int smb_conn_chmod (struct smb_conn_ctx *ctx, const char *url, mode_t mode)
 
int smb_conn_utimes (struct smb_conn_ctx *ctx, const char *url, struct timeval *tbuf)
 
int smb_conn_setxattr (struct smb_conn_ctx *ctx, const char *url, const char *name, const void *value, size_t size, int flags)
 
int smb_conn_getxattr (struct smb_conn_ctx *ctx, const char *url, const char *name, void *value, size_t size)
 
int smb_conn_listxattr (struct smb_conn_ctx *ctx, const char *url, char *list, size_t size)
 
int smb_conn_removexattr (struct smb_conn_ctx *ctx, const char *url, const char *name)
 

Variables

static int smb_conn_max_retry_count = 2
 
static int smb_conn_max_passwd_query_count = 10
 
static int smb_conn_server_reply_timeout = 60
 

Macro Definition Documentation

◆ MAP_ANONYMOUS

#define MAP_ANONYMOUS   MAP_ANON

Definition at line 28 of file smb_conn.c.

◆ SMB_CONN_PROCESS_STATE_ALIVE

#define SMB_CONN_PROCESS_STATE_ALIVE   0

Definition at line 32 of file smb_conn.c.

◆ SMB_CONN_PROCESS_STATE_DIED

#define SMB_CONN_PROCESS_STATE_DIED   1

Definition at line 33 of file smb_conn.c.

◆ SMB_CONN_PROCESS_STATE_UNKNOWN

#define SMB_CONN_PROCESS_STATE_UNKNOWN   -1

Definition at line 31 of file smb_conn.c.

Function Documentation

◆ smb_conn_chmod()

int smb_conn_chmod ( struct smb_conn_ctx ctx,
const char *  url,
mode_t  mode 
)

◆ smb_conn_close()

◆ smb_conn_closedir()

◆ smb_conn_connection_close()

◆ smb_conn_creat()

◆ smb_conn_ctx_destroy()

◆ smb_conn_ctx_init()

◆ smb_conn_fstat()

◆ smb_conn_ftruncate()

◆ smb_conn_get_max_passwd_query_count()

static int smb_conn_get_max_passwd_query_count ( void  )
inlinestatic

Definition at line 100 of file smb_conn.c.

References smb_conn_max_passwd_query_count.

Referenced by smb_conn_process_query_lowlevel_va().

◆ smb_conn_get_max_retry_count()

static int smb_conn_get_max_retry_count ( void  )
inlinestatic

Definition at line 89 of file smb_conn.c.

References smb_conn_max_retry_count.

Referenced by smb_conn_process_fd_query(), and smb_conn_process_query().

◆ smb_conn_get_server_reply_timeout()

static int smb_conn_get_server_reply_timeout ( void  )
inlinestatic

Definition at line 111 of file smb_conn.c.

References smb_conn_server_reply_timeout.

Referenced by smb_conn_process_query_lowlevel_va().

◆ smb_conn_getxattr()

int smb_conn_getxattr ( struct smb_conn_ctx ctx,
const char *  url,
const char *  name,
void *  value,
size_t  size 
)

◆ smb_conn_is_neg_cache_candidate()

static int smb_conn_is_neg_cache_candidate ( enum smb_conn_cmd  query_cmd,
struct smb_conn_query_result result 
)
inlinestatic

◆ smb_conn_listxattr()

int smb_conn_listxattr ( struct smb_conn_ctx ctx,
const char *  url,
char *  list,
size_t  size 
)

◆ smb_conn_mkdir()

int smb_conn_mkdir ( struct smb_conn_ctx ctx,
const char *  url,
mode_t  mode 
)

◆ smb_conn_open()

◆ smb_conn_opendir()

◆ smb_conn_process_fd_query()

static int smb_conn_process_fd_query ( struct smb_conn_ctx ctx,
enum smb_conn_cmd  query_cmd,
struct smb_conn_file file,
smb_conn_srv_fd query_fd_ptr,
void *  query,
size_t  query_len,
void *  reply,
size_t  reply_len 
)
static

◆ smb_conn_process_query()

◆ smb_conn_process_query_lowlevel()

static int smb_conn_process_query_lowlevel ( struct smb_conn_ctx ctx,
enum smb_conn_cmd  query_cmd,
void *  query,
size_t  query_len,
struct smb_conn_query_result result,
void *  reply,
size_t  reply_len,
  ... 
)
static

◆ smb_conn_process_query_lowlevel_va()

◆ smb_conn_query_result_check()

static int smb_conn_query_result_check ( enum smb_conn_cmd  query_cmd,
struct smb_conn_query_result result 
)
inlinestatic

◆ smb_conn_query_result_map()

static int smb_conn_query_result_map ( struct smb_conn_query_result result)
inlinestatic

◆ smb_conn_read()

◆ smb_conn_readdir()

◆ smb_conn_removexattr()

int smb_conn_removexattr ( struct smb_conn_ctx ctx,
const char *  url,
const char *  name 
)

◆ smb_conn_rename()

int smb_conn_rename ( struct smb_conn_ctx ctx,
const char *  old_url,
const char *  new_url 
)

◆ smb_conn_rmdir()

int smb_conn_rmdir ( struct smb_conn_ctx ctx,
const char *  url 
)

◆ smb_conn_send_password()

static int smb_conn_send_password ( struct smb_conn_ctx ctx,
const char *  server,
const char *  share 
)
static

◆ smb_conn_send_password_base()

static int smb_conn_send_password_base ( struct smb_conn_ctx ctx,
const char *  domain,
const char *  user,
const char *  password 
)
static

◆ smb_conn_set_max_passwd_query_count()

int smb_conn_set_max_passwd_query_count ( int  count)

Definition at line 93 of file smb_conn.c.

References DPRINTF, and smb_conn_max_passwd_query_count.

Referenced by reconfigure_analyse_simple_option().

◆ smb_conn_set_max_retry_count()

int smb_conn_set_max_retry_count ( int  count)

Definition at line 82 of file smb_conn.c.

References DPRINTF, and smb_conn_max_retry_count.

Referenced by reconfigure_analyse_simple_option().

◆ smb_conn_set_server_reply_timeout()

int smb_conn_set_server_reply_timeout ( int  timeout)

Definition at line 104 of file smb_conn.c.

References DPRINTF, and smb_conn_server_reply_timeout.

Referenced by reconfigure_analyse_simple_option().

◆ smb_conn_setxattr()

int smb_conn_setxattr ( struct smb_conn_ctx ctx,
const char *  url,
const char *  name,
const void *  value,
size_t  size,
int  flags 
)

◆ smb_conn_stat()

int smb_conn_stat ( struct smb_conn_ctx ctx,
const char *  url,
struct stat *  st 
)

◆ smb_conn_unlink()

int smb_conn_unlink ( struct smb_conn_ctx ctx,
const char *  url 
)

◆ smb_conn_up_if_broken()

◆ smb_conn_utimes()

int smb_conn_utimes ( struct smb_conn_ctx ctx,
const char *  url,
struct timeval *  tbuf 
)

◆ smb_conn_write()

Variable Documentation

◆ smb_conn_max_passwd_query_count

int smb_conn_max_passwd_query_count = 10
static

◆ smb_conn_max_retry_count

int smb_conn_max_retry_count = 2
static

Definition at line 41 of file smb_conn.c.

Referenced by smb_conn_get_max_retry_count(), and smb_conn_set_max_retry_count().

◆ smb_conn_server_reply_timeout

int smb_conn_server_reply_timeout = 60
static