]> arthur.barton.de Git - netatalk.git/blob - include/atalk/globals.h
Enhance ACL mapping
[netatalk.git] / include / atalk / globals.h
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 <sys/param.h>
10 #include <grp.h>
11 #include <sys/types.h>
12
13 #ifdef HAVE_NETDB_H
14 #include <netdb.h>  /* this isn't header-protected under ultrix */
15 #endif /* HAVE_NETDB_H */
16
17 #include <atalk/afp.h>
18 #include <atalk/compat.h>
19 #include <atalk/unicode.h>
20 #include <atalk/uam.h>
21 #include <atalk/iniparser.h>
22 #ifdef WITH_DTRACE
23 #include <atalk/afp_dtrace.h>
24 #else
25 /* List of empty dtrace macros */
26 #define AFP_AFPFUNC_START(a,b)
27 #define AFP_AFPFUNC_DONE(a, b)
28 #define AFP_CNID_START(a)
29 #define AFP_CNID_DONE()
30 #define AFP_READ_START(a)
31 #define AFP_READ_DONE()
32 #define AFP_WRITE_START(a)
33 #define AFP_WRITE_DONE()
34 #endif
35
36 /* #define DOSFILELEN 12 */             /* Type1, DOS-compat*/
37 #define MACFILELEN 31                   /* Type2, HFS-compat */
38 #define UTF8FILELEN_EARLY 255           /* Type3, early Mac OS X 10.0-10.4.? */
39 /* #define UTF8FILELEN_NAME_MAX 765 */  /* Type3, 10.4.?- , getconf NAME_MAX */
40 /* #define UTF8FILELEN_SPEC 0xFFFF */   /* Type3, spec on document */
41 /* #define HFSPLUSFILELEN 510 */        /* HFS+ spec, 510byte = 255codepoint */
42
43 #define MAXUSERLEN 256
44
45 #define DEFAULT_MAX_DIRCACHE_SIZE 8192
46
47 #define OPTION_DEBUG         (1 << 0)
48 #define OPTION_CLOSEVOL      (1 << 1)
49 #define OPTION_SERVERNOTIF   (1 << 2)
50 #define OPTION_NOSENDFILE    (1 << 3)
51 /* #define OPTION_CUSTOMICON    (1 << 4) */
52 #define OPTION_AFP_READ_LOCK (1 << 5) /* whether to do AFP spec conforming read locks (default: no) */
53 #define OPTION_ANNOUNCESSH   (1 << 6)
54 #define OPTION_UUID          (1 << 7)
55 #define OPTION_ACL2MACCESS   (1 << 8)
56 #define OPTION_NOZEROCONF    (1 << 9)
57 #define OPTION_ACL2MODE      (1 << 10)
58 #define OPTION_SHARE_RESERV  (1 << 11) /* whether to use Solaris fcntl F_SHARE locks */
59 #define OPTION_DBUS_AFPSTATS (1 << 12) /* whether to run dbus thread for afpstats */
60
61 #define PASSWD_NONE     0
62 #define PASSWD_SET     (1 << 0)
63 #define PASSWD_NOSAVE  (1 << 1)
64 #define PASSWD_ALL     (PASSWD_SET | PASSWD_NOSAVE)
65
66 #define IS_AFP_SESSION(obj) ((obj)->dsi && (obj)->dsi->serversock == -1)
67
68 /**********************************************************************************************
69  * Ini config sections
70  **********************************************************************************************/
71
72 #define INISEC_GLOBAL "Global"
73 #define INISEC_HOMES  "Homes"
74
75 struct DSI;
76 #define AFPOBJ_TMPSIZ (MAXPATHLEN)
77
78 struct afp_volume_name {
79     time_t     mtime;
80     int        loaded;
81 };
82
83 struct afp_options {
84     int connections;            /* Maximum number of possible AFP connections */
85     int tickleval;
86     int timeout;
87     int flags;
88     int dircachesize;
89     int sleep;                  /* Maximum time allowed to sleep (in tickles) */
90     int disconnected;           /* Maximum time in disconnected state (in tickles) */
91     int fce_fmodwait;           /* number of seconds FCE file mod events are put on hold */
92     unsigned int tcp_sndbuf, tcp_rcvbuf;
93     unsigned char passwdbits, passwdminlen;
94     uint32_t server_quantum;
95     int dsireadbuf; /* scale factor for sizefof(dsi->buffer) = server_quantum * dsireadbuf */
96     char *hostname;
97     char *listen, *port;
98     char *Cnid_srv, *Cnid_port;
99     char *configfile;
100     char *uampath, *fqdn;
101     char *sigconffile;
102     char *uuidconf;
103     char *guest, *loginmesg, *keyfile, *passwdfile, *extmapfile;
104     char *uamlist;
105     char *signatureopt;
106     unsigned char signature[16];
107     char *k5service, *k5realm, *k5keytab;
108     char *unixcodepage, *maccodepage, *volcodepage;
109     charset_t maccharset, unixcharset; 
110     mode_t umask;
111     mode_t save_mask;
112     gid_t admingid;
113     int    volnamelen;
114     /* default value for winbind authentication */
115     char *ntdomain, *ntseparator, *addomain;
116     char *logconfig;
117     char *logfile;
118     char *mimicmodel;
119     char *adminauthuser;
120     struct afp_volume_name volfile;
121 };
122
123 typedef struct AFPObj {
124     const char *cmdlineconfigfile;
125     int cmdlineflags;
126     const void *signature;
127     struct DSI *dsi;
128     struct afp_options options;
129     dictionary *iniconfig;
130     char username[MAXUSERLEN];
131     /* to prevent confusion, only use these in afp_* calls */
132     char oldtmp[AFPOBJ_TMPSIZ + 1], newtmp[AFPOBJ_TMPSIZ + 1];
133     void *uam_cookie; /* cookie for uams */
134     struct session_info  sinfo;
135     uid_t uid;  /* client running user id */
136     int ipc_fd; /* anonymous PF_UNIX socket for IPC with afpd parent */
137     gid_t *groups;
138     int ngroups;
139     int afp_version;
140     /* Functions */
141     void (*logout)(void);
142     void (*exit)(int);
143     int (*reply)(void *, int);
144     int (*attention)(void *, AFPUserBytes);
145 } AFPObj;
146
147 /* typedef for AFP functions handlers */
148 typedef int (*AFPCmd)(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
149
150 /* Global variables */
151 extern AFPObj             *AFPobj;
152 extern int                afp_version;
153 extern int                afp_errno;
154 extern unsigned char      nologin;
155 extern struct dir         *curdir;
156 extern char               getwdbuf[];
157 extern struct afp_options default_options;
158 extern const char         *Cnid_srv;
159 extern const char         *Cnid_port;
160
161 extern int  get_afp_errno   (const int param);
162 extern void afp_options_init (struct afp_options *);
163 extern void afp_options_parse_cmdline(AFPObj *obj, int ac, char **av);
164 extern void setmessage (const char *);
165 extern void readmessage (AFPObj *);
166
167 /* afp_util.c */
168 extern const char *AfpNum2name (int );
169 extern const char *AfpErr2name(int err);
170
171 /* directory.c */
172 extern struct dir rootParent;
173
174 extern void afp_over_dsi (AFPObj *);
175 extern void afp_over_dsi_sighandlers(AFPObj *obj);
176 #endif /* globals.h */