netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
cnid_metad.c File Reference
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <time.h>
#include <bstrlib.h>
#include <pwd.h>
#include <grp.h>
#include <atalk/util.h>
#include <atalk/logger.h>
#include <atalk/cnid_bdb_private.h>
#include <atalk/compat.h>
#include <atalk/errchk.h>
#include <atalk/iniparser_util.h>
#include <atalk/netatalk_conf.h>
#include <atalk/volume.h>
#include "usockfd.h"

Data Structures

struct  server

Macros

#define WEXITSTATUS(stat_val)
#define WIFEXITED(stat_val)
#define WIFSTOPPED(status)
#define WIFSIGNALED(status)
#define WTERMSIG(status)
#define SWITCH_TO_GID(gid)
#define SWITCH_TO_UID(uid)
#define DBHOME   ".AppleDB"
#define DBHOMELEN   8
#define MAXSPAWN   3
#define TESTTIME   10
#define MAXVOLS   4096
#define DEFAULTHOST   "localhost"
#define DEFAULTPORT   "4700"

Functions

static void daemon_exit (int i)
static void sig_handler (int sig)
static struct servertest_usockfn (const char *path)
int maybe_start_dbd (const AFPObj *obj, char *dbdpn, const char *volpath, const char *username)
static int set_dbdir (const char *dbdir, const char *vpath)
static void catch_child (int sig _U_)
static void set_signal (void)
static int setlimits (void)
static uid_t uid_from_name (const char *name)
int main (int argc, char *argv[])

Variables

static int srvfd
static int rqstfd
static volatile sig_atomic_t sigchild = 0
static uint maxvol
static struct server srv [MAXVOLS]

Macro Definition Documentation

◆ DBHOME

#define DBHOME   ".AppleDB"

◆ DBHOMELEN

#define DBHOMELEN   8

◆ DEFAULTHOST

#define DEFAULTHOST   "localhost"

◆ DEFAULTPORT

#define DEFAULTPORT   "4700"

◆ MAXSPAWN

#define MAXSPAWN   3

◆ MAXVOLS

#define MAXVOLS   4096

◆ SWITCH_TO_GID

#define SWITCH_TO_GID ( gid)
Value:
((setegid(gid) < 0 || setgid(gid) < 0) ? -1 : 0)

◆ SWITCH_TO_UID

#define SWITCH_TO_UID ( uid)
Value:
((setuid(uid) < 0 || seteuid(uid) < 0 || setuid(uid) < 0) ? -1 : 0)

◆ TESTTIME

#define TESTTIME   10

◆ WEXITSTATUS

#define WEXITSTATUS ( stat_val)
Value:
((unsigned)(stat_val) >> 8)

◆ WIFEXITED

#define WIFEXITED ( stat_val)
Value:
(((stat_val) & 255) == 0)

◆ WIFSIGNALED

#define WIFSIGNALED ( status)
Value:
#define WIFEXITED(stat_val)
Definition cnid_metad.c:57
#define WIFSTOPPED(status)
Definition cnid_metad.c:60
static char * status
Definition pap.c:93

◆ WIFSTOPPED

#define WIFSTOPPED ( status)
Value:
(((status) & 0xff) == 0x7f)

◆ WTERMSIG

#define WTERMSIG ( status)
Value:
((status) & 0x7f)

Function Documentation

◆ catch_child()

void catch_child ( int sig _U_)
static

◆ daemon_exit()

void daemon_exit ( int i)
static

◆ main()

int main ( int argc ,
char * argv[] )

◆ maybe_start_dbd()

int maybe_start_dbd ( const AFPObj * obj,
char * dbdpn,
const char * volpath,
const char * username )

Pass connection request to existing cnid_dbd process or start a new one

Parameters
[in]objhandle
[in]dbdpnPath to cnid_dbd binary
[in]volpathPath of AFP volume
[in]usernameOptional username, may be NULL
Returns
0 on success, -1 on error

◆ set_dbdir()

int set_dbdir ( const char * dbdir,
const char * vpath )
static

◆ set_signal()

void set_signal ( void )
static

◆ setlimits()

int setlimits ( void )
static

◆ sig_handler()

void sig_handler ( int sig)
static

◆ test_usockfn()

struct server * test_usockfn ( const char * path)
static

◆ uid_from_name()

uid_t uid_from_name ( const char * name)
static

Variable Documentation

◆ maxvol

uint maxvol
static

◆ rqstfd

int rqstfd
static

◆ sigchild

volatile sig_atomic_t sigchild = 0
static

◆ srv

struct server srv[MAXVOLS]
static

◆ srvfd

int srvfd
static