netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
globals.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1990,1993 Regents of The University of Michigan.
3 * All Rights Reserved. See COPYRIGHT.
4 */
5
6#ifndef AFPD_GLOBALS_H
7#define AFPD_GLOBALS_H 1
8
9#include <grp.h>
10#ifdef HAVE_INIPARSER_INIPARSER_H
11#include <iniparser/iniparser.h>
12#else
13#include <iniparser.h>
14#endif
15#include <netdb.h>
16#include <stdbool.h>
17#include <sys/param.h>
18#include <sys/types.h>
19
20#include <netatalk/at.h>
21#include <atalk/afp.h>
22#include <atalk/compat.h>
23#include <atalk/uam.h>
24#include <atalk/unicode.h>
25
26#ifdef WITH_DTRACE
27#include <atalk/afp_dtrace.h>
28#else
29/* List of empty dtrace macros */
30#define AFP_AFPFUNC_START(a,b)
31#define AFP_AFPFUNC_DONE(a, b)
32#define AFP_CNID_START(a)
33#define AFP_CNID_DONE()
34#define AFP_READ_START(a)
35#define AFP_READ_DONE()
36#define AFP_WRITE_START(a)
37#define AFP_WRITE_DONE()
38#endif
39
40/* #define DOSFILELEN 12 */ /* Type1, DOS-compat*/
41#define MACFILELEN 31
42#define UTF8FILELEN_EARLY 255
43/* #define UTF8FILELEN_NAME_MAX 765 */ /* Type3, 10.4.?- , getconf NAME_MAX */
44/* #define UTF8FILELEN_SPEC 0xFFFF */ /* Type3, spec on document */
45/* #define HFSPLUSFILELEN 510 */ /* HFS+ spec, 510byte = 255codepoint */
46
47#define MAXUSERLEN 256
48#define MAXOPTLEN 256
49
50#define CNID_PATH_OVERHEAD 12 /* CNID protocol header size for path resolution */
51#define CNID_MAX_PATH_LEN (CNID_PATH_OVERHEAD + MAXPATHLEN + 1) /* Maximum path length for CNID operations */
52
53#define DEFAULT_MAX_DIRCACHE_SIZE 8192
54
55/* Directory cache validation settings */
56#define DEFAULT_DIRCACHE_VALIDATION_FREQ 1
57
58#define OPTION_DEBUG (1 << 0)
59#define OPTION_CLOSEVOL (1 << 1)
60#define OPTION_SERVERNOTIF (1 << 2)
61#define OPTION_NOSENDFILE (1 << 3)
62#define OPTION_VETOMSG (1 << 4)
63#define OPTION_AFP_READ_LOCK (1 << 5)
64#define OPTION_ANNOUNCESSH (1 << 6)
65#define OPTION_UUID (1 << 7)
66#define OPTION_ACL2MACCESS (1 << 8)
67#define OPTION_NOZEROCONF (1 << 9)
68#define OPTION_ACL2MODE (1 << 10)
69#define OPTION_SHARE_RESERV (1 << 11)
70#define OPTION_AFPSTATS (1 << 12)
71#define OPTION_SPOTLIGHT (1 << 13)
72#define OPTION_SPOTLIGHT_VOL (1 << 14)
73#define OPTION_RECVFILE (1 << 15)
74#define OPTION_SPOTLIGHT_EXPR (1 << 16)
75#define OPTION_DDP (1 << 17)
76#define OPTION_VALID_SHELLCHECK (1 << 18)
77
78#define PASSWD_NONE 0
79#define PASSWD_SET (1 << 0)
80#define PASSWD_NOSAVE (1 << 1)
81#define PASSWD_ALL (PASSWD_SET | PASSWD_NOSAVE)
82
83#define IS_AFP_SESSION(obj) (((obj)->dsi && (obj)->dsi->serversock == -1) || ((obj)->Type))
84
85 struct DSI;
86
87#define AFPOBJ_TMPSIZ (MAXPATHLEN)
88
89 struct afp_volume_name {
90 time_t mtime;
91 int loaded;
92};
93
94/* Tier 2: Resource Fork data cache hard caps (in KB) */
95#define RFORK_BUDGET_MAX_KB (10 * 1024 * 1024)
96#define RFORK_ENTRY_MAX_KB (10 * 1024)
97
98 struct afp_options {
99 int connections;
100 int tickleval;
101 int timeout;
102 int flags;
103 int dircachesize;
104 int dircache_mode;
105 int dircache_validation_freq;
106 int dircache_rfork_budget;
107 int dircache_rfork_maxentry;
108 int sleep;
109 int disconnected;
110#ifdef WITH_FCE
111 int fce_fmodwait;
112 int fce_sendwait;
113#endif /* WITH_FCE */
114 unsigned int tcp_sndbuf, tcp_rcvbuf;
115 unsigned char passwdbits, passwdminlen;
116 uint32_t server_quantum;
117 int dsireadbuf;
118 char *hostname;
119 char *zone;
120#ifndef NO_DDP
121 struct at_addr ddpaddr;
122#endif
123 char *listen, *interfaces, *port;
124 char *Cnid_srv, *Cnid_port;
125 char *configfile;
126 char *uampath, *fqdn;
127 char *sigconffile;
128 char *uuidconf;
129 char *guest, *loginmesg, *keyfile, *passwdfile, *srppasswdfile, *extmapfile;
130 char *uamlist;
131 char *signatureopt;
132 unsigned char signature[16];
133 char *k5service, *k5realm, *k5keytab;
134 size_t k5principal_buflen;
135 char *k5principal;
136 char *unixcodepage, *maccodepage, *volcodepage;
137 charset_t maccharset, unixcharset;
138 mode_t umask;
139 mode_t save_mask;
140 gid_t admingid;
141 bool afpstats_group;
142 gid_t afpstats_gid;
143 bool force_user;
144 uid_t force_uid;
145 bool force_group;
146 gid_t force_gid;
147 int volnamelen;
148 /* default value for winbind authentication */
149 char *ntdomain, *ntseparator, *addomain;
150 char *logconfig;
151 char *logfile;
152 bool log_us_timestamp;
153 char *legacyicon;
154 char *mimicmodel;
155 char *servername;
156 char *ignored_attr;
157 int splice_size;
158 char *cnid_mysql_host;
159 char *cnid_mysql_user;
160 char *cnid_mysql_pw;
161 char *cnid_mysql_db;
162 struct afp_volume_name volfile;
163 uint64_t sparql_limit;
164};
165
166 typedef struct AFPObj {
167 char *cmdlineconfigfile;
168 int cmdlineflags;
169 int proto;
170 const void *signature;
171 struct DSI *dsi;
172 void *handle;
173#ifndef NO_DDP
174 int fd;
175 int statuslen;
176 char aspstatus[1400];
177#endif /* NO_DDP */
178 struct afp_options options;
179 char *Obj, *Type, *Zone;
180 dictionary *iniconfig;
181 char username[MAXUSERLEN];
182 /* to prevent confusion, only use these in afp_* calls */
183 char oldtmp[AFPOBJ_TMPSIZ + 1], newtmp[AFPOBJ_TMPSIZ + 1];
184 void *uam_cookie;
185 struct session_info sinfo;
186 uid_t uid;
187 uid_t euid;
188 pid_t pid;
189 int ipc_fd;
190 int hint_fd;
191 gid_t *groups;
192 int ngroups;
193 int afp_version;
194 int cnx_cnt, cnx_max;
195 /* Functions */
196 void (*logout)(void);
197 void (*exit)(int);
198 int (*reply)(void *, int);
199 int (*attention)(void *, AFPUserBytes);
200#ifdef WITH_FCE
201 int fce_version;
202 char *fce_ign_names;
203 char *fce_ign_directories;
204 char *fce_notify_script;
205#endif /* WITH_FCE */
206 void *sl_ctx;
207} AFPObj;
208
210 typedef int (*AFPCmd)(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
211 size_t *rbuflen);
212
213/* Global variables */
214 extern AFPObj *AFPobj;
215 extern int afp_version;
216 extern int afp_errno;
217 extern unsigned char nologin;
218 extern struct dir *curdir;
219 extern char getwdbuf[];
220 extern struct afp_options default_options;
221 extern const char *Cnid_srv;
222 extern const char *Cnid_port;
223
224 extern int get_afp_errno(const int param);
225 extern void afp_options_init(struct afp_options *);
226 extern void afp_options_parse_cmdline(AFPObj *obj, int ac, char **av);
227 extern int setmessage(const char *);
228 extern void readmessage(AFPObj *);
229
230#ifndef NO_DDP
231 extern void afp_over_asp(AFPObj *);
232#endif /* NO_DDP */
233 extern void afp_over_dsi(AFPObj *);
234 extern void afp_over_dsi_sighandlers(AFPObj *obj);
235#endif /* globals.h */
afp.h
AFPUserBytes
uint16_t AFPUserBytes
Definition afp.h:30
AFPobj
AFPObj * AFPobj
Definition afp_dsi.c:70
rbuflen
static size_t rbuflen
Definition afpfunc_helpers.c:45
rbuf
static char rbuf[rbufsize]
Definition afpfunc_helpers.c:44
at.h
compat.h
curdir
struct dir * curdir
Definition directory.c:82
afp_errno
int afp_errno
Definition directory.c:70
nologin
unsigned char nologin
Definition etc/afpd/main.c:47
default_options
struct afp_options default_options
setmessage
int setmessage(const char *)
Copy AFP message to message buffer.
Definition messages.c:37
MAXUSERLEN
#define MAXUSERLEN
Definition globals.h:47
AFPCmd
int(* AFPCmd)(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition globals.h:210
AFPOBJ_TMPSIZ
#define AFPOBJ_TMPSIZ
Definition globals.h:87
get_afp_errno
int get_afp_errno(const int param)
Definition directory.c:498
readmessage
void readmessage(AFPObj *)
Definition messages.c:47
afp_options_parse_cmdline
void afp_options_parse_cmdline(AFPObj *obj, int ac, char **av)
Definition afp_options.c:189
afp_options_init
void afp_options_init(struct afp_options *)
afp_over_dsi
void afp_over_dsi(AFPObj *)
Definition afp_dsi.c:703
afp_version
int afp_version
Cnid_port
const char * Cnid_port
Cnid_srv
const char * Cnid_srv
afp_over_dsi_sighandlers
void afp_over_dsi_sighandlers(AFPObj *obj)
Definition afp_dsi.c:613
getwdbuf
char getwdbuf[]
afp_over_asp
void afp_over_asp(AFPObj *)
Definition afp_asp.c:150
obj
static AFPObj obj
Definition netatalk.c:69
AFPObj
Definition globals.h:166
AFPObj::aspstatus
char aspstatus[1400]
Definition globals.h:176
AFPObj::Type
char * Type
Definition globals.h:179
AFPObj::fd
int fd
Definition globals.h:174
AFPObj::exit
void(* exit)(int)
Definition globals.h:197
AFPObj::newtmp
char newtmp[AFPOBJ_TMPSIZ+1]
Definition globals.h:183
AFPObj::Zone
char * Zone
Definition globals.h:179
AFPObj::pid
pid_t pid
Definition globals.h:188
AFPObj::reply
int(* reply)(void *, int)
Definition globals.h:198
AFPObj::ngroups
int ngroups
Definition globals.h:192
AFPObj::uid
uid_t uid
Definition globals.h:186
AFPObj::cnx_max
int cnx_max
Definition globals.h:194
AFPObj::sinfo
struct session_info sinfo
Definition globals.h:185
AFPObj::cmdlineconfigfile
char * cmdlineconfigfile
Definition globals.h:167
AFPObj::statuslen
int statuslen
Definition globals.h:175
AFPObj::hint_fd
int hint_fd
Definition globals.h:190
AFPObj::oldtmp
char oldtmp[AFPOBJ_TMPSIZ+1]
Definition globals.h:183
AFPObj::signature
const void * signature
Definition globals.h:170
AFPObj::options
struct afp_options options
Definition globals.h:178
AFPObj::username
char username[MAXUSERLEN]
Definition globals.h:181
AFPObj::Obj
char * Obj
Definition globals.h:179
AFPObj::sl_ctx
void * sl_ctx
Definition globals.h:206
AFPObj::uam_cookie
void * uam_cookie
Definition globals.h:184
AFPObj::logout
void(* logout)(void)
Definition globals.h:196
AFPObj::euid
uid_t euid
Definition globals.h:187
AFPObj::cnx_cnt
int cnx_cnt
Definition globals.h:194
AFPObj::cmdlineflags
int cmdlineflags
Definition globals.h:168
AFPObj::ipc_fd
int ipc_fd
Definition globals.h:189
AFPObj::afp_version
int afp_version
Definition globals.h:193
AFPObj::groups
gid_t * groups
Definition globals.h:191
AFPObj::handle
void * handle
Definition globals.h:172
AFPObj::iniconfig
dictionary * iniconfig
Definition globals.h:180
AFPObj::dsi
struct DSI * dsi
Definition globals.h:171
AFPObj::proto
int proto
Definition globals.h:169
AFPObj::attention
int(* attention)(void *, AFPUserBytes)
Definition globals.h:199
DSI
Definition include/atalk/dsi.h:58
afp_options
Definition globals.h:98
afp_options::tcp_sndbuf
unsigned int tcp_sndbuf
Definition globals.h:114
afp_options::maccharset
charset_t maccharset
Definition globals.h:137
afp_options::dircache_validation_freq
int dircache_validation_freq
Definition globals.h:105
afp_options::force_uid
uid_t force_uid
Definition globals.h:144
afp_options::logconfig
char * logconfig
Definition globals.h:150
afp_options::signature
unsigned char signature[16]
Definition globals.h:132
afp_options::configfile
char * configfile
Definition globals.h:125
afp_options::dircache_mode
int dircache_mode
Definition globals.h:104
afp_options::uampath
char * uampath
Definition globals.h:126
afp_options::guest
char * guest
Definition globals.h:129
afp_options::force_gid
gid_t force_gid
Definition globals.h:146
afp_options::signatureopt
char * signatureopt
Definition globals.h:131
afp_options::cnid_mysql_db
char * cnid_mysql_db
Definition globals.h:161
afp_options::afpstats_group
bool afpstats_group
Definition globals.h:141
afp_options::fqdn
char * fqdn
Definition globals.h:126
afp_options::zone
char * zone
Definition globals.h:119
afp_options::volfile
struct afp_volume_name volfile
Definition globals.h:162
afp_options::logfile
char * logfile
Definition globals.h:151
afp_options::uuidconf
char * uuidconf
Definition globals.h:128
afp_options::disconnected
int disconnected
Definition globals.h:109
afp_options::admingid
gid_t admingid
Definition globals.h:140
afp_options::volnamelen
int volnamelen
Definition globals.h:147
afp_options::Cnid_srv
char * Cnid_srv
Definition globals.h:124
afp_options::log_us_timestamp
bool log_us_timestamp
Definition globals.h:152
afp_options::servername
char * servername
Definition globals.h:155
afp_options::cnid_mysql_host
char * cnid_mysql_host
Definition globals.h:158
afp_options::tickleval
int tickleval
Definition globals.h:100
afp_options::sleep
int sleep
Definition globals.h:108
afp_options::k5keytab
char * k5keytab
Definition globals.h:133
afp_options::hostname
char * hostname
Definition globals.h:118
afp_options::addomain
char * addomain
Definition globals.h:149
afp_options::passwdminlen
unsigned char passwdminlen
Definition globals.h:115
afp_options::force_user
bool force_user
Definition globals.h:143
afp_options::extmapfile
char * extmapfile
Definition globals.h:129
afp_options::listen
char * listen
Definition globals.h:123
afp_options::timeout
int timeout
Definition globals.h:101
afp_options::sigconffile
char * sigconffile
Definition globals.h:127
afp_options::Cnid_port
char * Cnid_port
Definition globals.h:124
afp_options::flags
int flags
Definition globals.h:102
afp_options::port
char * port
Definition globals.h:123
afp_options::k5principal_buflen
size_t k5principal_buflen
Definition globals.h:134
afp_options::dircache_rfork_budget
int dircache_rfork_budget
Definition globals.h:106
afp_options::cnid_mysql_pw
char * cnid_mysql_pw
Definition globals.h:160
afp_options::dsireadbuf
int dsireadbuf
Definition globals.h:117
afp_options::dircachesize
int dircachesize
Definition globals.h:103
afp_options::k5service
char * k5service
Definition globals.h:133
afp_options::afpstats_gid
gid_t afpstats_gid
Definition globals.h:142
afp_options::unixcharset
charset_t unixcharset
Definition globals.h:137
afp_options::ddpaddr
struct at_addr ddpaddr
Definition globals.h:121
afp_options::cnid_mysql_user
char * cnid_mysql_user
Definition globals.h:159
afp_options::force_group
bool force_group
Definition globals.h:145
afp_options::connections
int connections
Definition globals.h:99
afp_options::keyfile
char * keyfile
Definition globals.h:129
afp_options::umask
mode_t umask
Definition globals.h:138
afp_options::k5principal
char * k5principal
Definition globals.h:135
afp_options::volcodepage
char * volcodepage
Definition globals.h:136
afp_options::maccodepage
char * maccodepage
Definition globals.h:136
afp_options::legacyicon
char * legacyicon
Definition globals.h:153
afp_options::mimicmodel
char * mimicmodel
Definition globals.h:154
afp_options::uamlist
char * uamlist
Definition globals.h:130
afp_options::loginmesg
char * loginmesg
Definition globals.h:129
afp_options::server_quantum
uint32_t server_quantum
Definition globals.h:116
afp_options::passwdbits
unsigned char passwdbits
Definition globals.h:115
afp_options::sparql_limit
uint64_t sparql_limit
Definition globals.h:163
afp_options::ignored_attr
char * ignored_attr
Definition globals.h:156
afp_options::passwdfile
char * passwdfile
Definition globals.h:129
afp_options::unixcodepage
char * unixcodepage
Definition globals.h:136
afp_options::ntdomain
char * ntdomain
Definition globals.h:149
afp_options::k5realm
char * k5realm
Definition globals.h:133
afp_options::dircache_rfork_maxentry
int dircache_rfork_maxentry
Definition globals.h:107
afp_options::ntseparator
char * ntseparator
Definition globals.h:149
afp_options::tcp_rcvbuf
unsigned int tcp_rcvbuf
Definition globals.h:114
afp_options::srppasswdfile
char * srppasswdfile
Definition globals.h:129
afp_options::splice_size
int splice_size
Definition globals.h:157
afp_options::save_mask
mode_t save_mask
Definition globals.h:139
afp_options::interfaces
char * interfaces
Definition globals.h:123
afp_volume_name
Definition globals.h:89
afp_volume_name::loaded
int loaded
Definition globals.h:91
afp_volume_name::mtime
time_t mtime
Definition globals.h:90
at_addr
Definition at.h:68
dir
Definition include/atalk/directory.h:56
param
Definition config.c:56
session_info
Definition uam.h:70
uam.h
unicode.h
charset_t
charset_t
Definition unicode.h:57