Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 182046 | Differences between
and this patch

Collapse All | Expand All

(-)afpfs-ng-0.8.1/cmdline/cmdline_afp.c (-3 / +3 lines)
Lines 3-11 Link Here
3
	
3
	
4
*/
4
*/
5
5
6
#include "afp.h"
6
#include "afpfs-ng/afp.h"
7
#include "midlevel.h"
7
#include "afpfs-ng/midlevel.h"
8
#include "map_def.h"
8
#include "afpfs-ng/map_def.h"
9
9
10
#include <string.h>
10
#include <string.h>
11
#include <stdio.h>
11
#include <stdio.h>
(-)afpfs-ng-0.8.1/cmdline/cmdline_testafp.c (-2 / +2 lines)
Lines 3-10 Link Here
3
	
3
	
4
*/
4
*/
5
5
6
#include "afp.h"
6
#include "afpfs-ng/afp.h"
7
#include "midlevel.h"
7
#include "afpfs-ng/midlevel.h"
8
8
9
#include "cmdline_main.h"
9
#include "cmdline_main.h"
10
10
(-)afpfs-ng-0.8.1/cmdline/getstatus.c (-1 / +1 lines)
Lines 2-8 Link Here
2
#include <string.h>
2
#include <string.h>
3
#include <pthread.h>
3
#include <pthread.h>
4
4
5
#include "afp.h"
5
#include "afpfs-ng/afp.h"
6
6
7
static int getstatus(char * address_string, unsigned int port)
7
static int getstatus(char * address_string, unsigned int port)
8
{
8
{
(-)afpfs-ng-0.8.1/configure.ac (-1 / +2 lines)
Lines 11-16 Link Here
11
AC_PROG_CC
11
AC_PROG_CC
12
AC_PROG_INSTALL
12
AC_PROG_INSTALL
13
AC_PROG_LIBTOOL
13
AC_PROG_LIBTOOL
14
AM_PROG_CC_C_O
14
15
15
# Checks for libraries.
16
# Checks for libraries.
16
# FIXME: Replace `main' with a function in `-lncurses':
17
# FIXME: Replace `main' with a function in `-lncurses':
Lines 105-111 Link Here
105
106
106
107
107
108
108
AC_CONFIG_FILES([lib/Makefile fuse/Makefile cmdline/Makefile Makefile docs/Makefile])
109
AC_CONFIG_FILES([lib/Makefile fuse/Makefile cmdline/Makefile Makefile include/Makefile include/afpfs-ng/Makefile docs/Makefile])
109
110
110
AC_OUTPUT
111
AC_OUTPUT
111
112
(-)afpfs-ng-0.8.1/fuse/client.c (-4 / +4 lines)
Lines 12-22 Link Here
12
#include <grp.h>
12
#include <grp.h>
13
13
14
#include "config.h"
14
#include "config.h"
15
#include <afp.h>
15
#include <afpfs-ng/afp.h>
16
#include "afp_server.h"
16
#include "afp_server.h"
17
#include "uams_def.h"
17
#include "afpfs-ng/uams_def.h"
18
#include "map_def.h"
18
#include "afpfs-ng/map_def.h"
19
#include "libafpclient.h"
19
#include "afpfs-ng/libafpclient.h"
20
20
21
#define default_uam "Cleartxt Passwrd"
21
#define default_uam "Cleartxt Passwrd"
22
22
(-)afpfs-ng-0.8.1/fuse/commands.c (-7 / +7 lines)
Lines 19-33 Link Here
19
#include <getopt.h>
19
#include <getopt.h>
20
#include <signal.h>
20
#include <signal.h>
21
21
22
#include "afp.h"
22
#include "afpfs-ng/afp.h"
23
#include "dsi.h"
23
#include "afpfs-ng/dsi.h"
24
#include "afp_server.h"
24
#include "afp_server.h"
25
#include "utils.h"
25
#include "afpfs-ng/utils.h"
26
#include "daemon.h"
26
#include "daemon.h"
27
#include "uams_def.h"
27
#include "afpfs-ng/uams_def.h"
28
#include "codepage.h"
28
#include "afpfs-ng/codepage.h"
29
#include "libafpclient.h"
29
#include "afpfs-ng/libafpclient.h"
30
#include "map_def.h"
30
#include "afpfs-ng/map_def.h"
31
#include "fuse_int.h"
31
#include "fuse_int.h"
32
#include "fuse_error.h"
32
#include "fuse_error.h"
33
#include "fuse_internal.h"
33
#include "fuse_internal.h"
(-)afpfs-ng-0.8.1/fuse/daemon.c (-3 / +3 lines)
Lines 23-33 Link Here
23
#include <signal.h>
23
#include <signal.h>
24
#include <sys/socket.h>
24
#include <sys/socket.h>
25
25
26
#include "afp.h"
26
#include "afpfs-ng/afp.h"
27
27
28
#include "dsi.h"
28
#include "afpfs-ng/dsi.h"
29
#include "afp_server.h"
29
#include "afp_server.h"
30
#include "utils.h"
30
#include "afpfs-ng/utils.h"
31
#include "daemon.h"
31
#include "daemon.h"
32
#include "commands.h"
32
#include "commands.h"
33
33
(-)afpfs-ng-0.8.1/fuse/fuse_error.c (-1 / +1 lines)
Lines 4-10 Link Here
4
#include <unistd.h>
4
#include <unistd.h>
5
#include <string.h>
5
#include <string.h>
6
#include <stdio.h>
6
#include <stdio.h>
7
#include "libafpclient.h"
7
#include "afpfs-ng/libafpclient.h"
8
#include "fuse_internal.h"
8
#include "fuse_internal.h"
9
9
10
#define TMP_FILE "/tmp/fuse_stderr"
10
#define TMP_FILE "/tmp/fuse_stderr"
(-)afpfs-ng-0.8.1/fuse/fuse_int.c (-5 / +5 lines)
Lines 18-24 Link Here
18
#define FUSE_USE_VERSION 25
18
#define FUSE_USE_VERSION 25
19
19
20
20
21
#include "afp.h"
21
#include "afpfs-ng/afp.h"
22
22
23
#include <fuse.h>
23
#include <fuse.h>
24
#include <stdio.h>
24
#include <stdio.h>
Lines 39-48 Link Here
39
#include <pwd.h>
39
#include <pwd.h>
40
#include <stdarg.h>
40
#include <stdarg.h>
41
41
42
#include "dsi.h"
42
#include "afpfs-ng/dsi.h"
43
#include "afp_protocol.h"
43
#include "afpfs-ng/afp_protocol.h"
44
#include "codepage.h"
44
#include "afpfs-ng/codepage.h"
45
#include "midlevel.h"
45
#include "afpfs-ng/midlevel.h"
46
#include "fuse_error.h"
46
#include "fuse_error.h"
47
47
48
/* Uncomment the following line to enable full debugging: */
48
/* Uncomment the following line to enable full debugging: */
(-)afpfs-ng-0.8.1/include/afpfs-ng/afp.h (+533 lines)
Line 0 Link Here
1
2
#ifndef _AFP_H_
3
#define _AFP_H_
4
5
#include <arpa/inet.h>
6
#include <pthread.h>
7
#include <netdb.h>
8
#include <sys/statvfs.h>
9
#include <pwd.h>
10
#include <afpfs-ng/afp_protocol.h>
11
#include <afpfs-ng/libafpclient.h>
12
#include <sys/types.h>
13
#include <sys/stat.h>
14
#include <unistd.h>
15
#include <netinet/in.h>
16
17
18
#define AFPFS_VERSION "0.8.1"
19
20
/* This is the maximum AFP version this library supports */
21
#define AFP_MAX_SUPPORTED_VERSION 32
22
23
/* afp_url is used to pass locations around */
24
struct afp_url {
25
	enum {TCPIP,AT} protocol;
26
	char username[AFP_MAX_USERNAME_LEN];
27
	char uamname[50];
28
	char password[AFP_MAX_PASSWORD_LEN];
29
	char servername[AFP_SERVER_NAME_UTF8_LEN];
30
	int port;
31
	char volumename[AFP_VOLUME_NAME_UTF8_LEN];
32
	char path[AFP_MAX_PATH];
33
34
	int requested_version;
35
	char zone[AFP_ZONE_LEN]; /* Only used for Appletalk */
36
	char volpassword[9];;
37
};
38
39
struct afp_token {
40
	unsigned int length;
41
	char data[AFP_TOKEN_MAX_LEN];
42
};
43
44
#define SERVER_MAX_VERSIONS 10
45
#define SERVER_MAX_UAMS 10
46
47
struct afp_rx_buffer {
48
	unsigned int size;
49
	unsigned int maxsize;
50
	char * data;
51
	int errorcode;
52
};
53
54
55
struct afp_file_info {
56
	unsigned short attributes;
57
	unsigned int did;
58
	unsigned int creation_date;
59
	unsigned int modification_date;
60
	unsigned int backup_date;
61
	unsigned int fileid;
62
	unsigned short offspring;
63
	char sync;
64
	char finderinfo[32];
65
	char name[AFP_MAX_PATH];
66
	char basename[AFP_MAX_PATH];
67
	char translated_name[AFP_MAX_PATH];
68
	struct afp_unixprivs unixprivs;
69
	unsigned int accessrights;
70
	struct afp_file_info * next;
71
	struct afp_file_info * largelist_next;
72
	unsigned char isdir;
73
	unsigned long long size;
74
	unsigned short resourcesize;
75
	unsigned int resource;
76
	unsigned short forkid;
77
	struct afp_icon * icon;
78
	int eof;
79
};
80
81
82
#define VOLUME_EXTRA_FLAGS_VOL_CHMOD_KNOWN 0x1
83
#define VOLUME_EXTRA_FLAGS_VOL_CHMOD_BROKEN 0x2
84
#define VOLUME_EXTRA_FLAGS_SHOW_APPLEDOUBLE 0x4
85
#define VOLUME_EXTRA_FLAGS_VOL_SUPPORTS_UNIX 0x8
86
#define VOLUME_EXTRA_FLAGS_NO_LOCKING 0x10
87
#define VOLUME_EXTRA_FLAGS_IGNORE_UNIXPRIVS 0x20
88
#define VOLUME_EXTRA_FLAGS_READONLY 0x40
89
90
#define AFP_VOLUME_UNMOUNTED 0
91
#define AFP_VOLUME_MOUNTED 1
92
#define AFP_VOLUME_UNMOUNTING 2
93
94
struct afp_volume {
95
	unsigned short volid;
96
	char flags;  /* This is from afpGetSrvrParms */
97
	unsigned short attributes; /* This is from VolOpen */
98
	unsigned short signature;  /* This is fixed or variable */
99
	unsigned int creation_date;
100
	unsigned int modification_date;
101
	unsigned int backup_date;
102
	struct statvfs stat;
103
	unsigned char mounted;
104
	char mountpoint[255];
105
	struct afp_server * server;
106
	char volume_name[AFP_VOLUME_NAME_LEN];
107
	char volume_name_printable[AFP_VOLUME_NAME_UTF8_LEN];
108
	unsigned short dtrefnum;
109
	char volpassword[AFP_VOLPASS_LEN];
110
	unsigned int extra_flags; /* This is an afpfs-ng specific field */
111
112
	/* Our directory ID cache */
113
	struct did_cache_entry * did_cache_base;
114
	pthread_mutex_t did_cache_mutex;
115
116
	/* Our journal of open forks */
117
	struct afp_file_info * open_forks;
118
	pthread_mutex_t open_forks_mutex;
119
120
	/* Used to trigger startup */
121
        pthread_cond_t  startup_condition_cond;
122
123
	struct {
124
		uint64_t hits;
125
		uint64_t misses;
126
		uint64_t expired;
127
		uint64_t force_removed;
128
	} did_cache_stats;
129
130
	void * priv;  /* This is a private structure for fuse/cmdline, etc */
131
	pthread_t thread; /* This is the per-volume thread */
132
133
	int mapping;
134
135
};
136
137
#define SERVER_STATE_CONNECTED 1
138
#define SERVER_STATE_DISCONNECTED 2
139
140
enum server_type{
141
	AFPFS_SERVER_TYPE_UNKNOWN,
142
	AFPFS_SERVER_TYPE_NETATALK,
143
	AFPFS_SERVER_TYPE_AIRPORT,
144
	AFPFS_SERVER_TYPE_MACINTOSH,
145
};
146
147
#define is_netatalk(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_NETATALK )
148
#define is_airport(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_AIRPORT )
149
#define is_macintosh(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_MACINTOSH )
150
151
152
153
struct afp_versions {
154
        char        *av_name;
155
        int         av_number;
156
};
157
extern struct afp_versions afp_versions[];
158
159
struct afp_server {
160
161
	/* Our buffer sizes */
162
	unsigned int tx_quantum;
163
	unsigned int rx_quantum;
164
165
	unsigned int tx_delay;
166
167
	/* Connection information */
168
	struct sockaddr_in address;
169
	int fd;
170
171
	/* Some stats, for information only */
172
	struct {
173
		uint64_t runt_packets;
174
		uint64_t incoming_dsi;
175
		uint64_t rx_bytes;
176
		uint64_t tx_bytes;
177
		uint64_t requests_pending;
178
	} stats;
179
180
	/* General information */
181
	char server_name[AFP_SERVER_NAME_LEN];
182
	char server_name_utf8[AFP_SERVER_NAME_UTF8_LEN];
183
        char server_name_printable[AFP_SERVER_NAME_UTF8_LEN];
184
185
	char machine_type[17];
186
	char icon[256];
187
	char signature[16];
188
	unsigned short flags;
189
	int connect_state;
190
	enum server_type server_type;
191
192
	/* This is the time we connected */
193
	time_t connect_time;
194
195
	/* UAMs */
196
	unsigned int supported_uams;
197
	unsigned int using_uam;
198
199
	/* Authentication */
200
	char username[AFP_MAX_USERNAME_LEN];
201
	char password[AFP_MAX_PASSWORD_LEN];
202
203
	/* Session */
204
	struct afp_token token;
205
	char need_resume;
206
207
	/* Versions */
208
	unsigned char requested_version;
209
	unsigned char versions[SERVER_MAX_VERSIONS];
210
	struct afp_versions *using_version;
211
212
	/* Volumes */
213
	unsigned char num_volumes;
214
	struct afp_volume * volumes;
215
216
	void * dsi;
217
	unsigned int exit_flag;
218
219
	/* Our DSI request queue */
220
	pthread_mutex_t requestid_mutex;
221
	pthread_mutex_t request_queue_mutex;
222
	unsigned short lastrequestid;
223
	unsigned short expectedrequestid;
224
	struct dsi_request * command_requests;
225
226
227
	char loginmesg[200];
228
	char servermesg[200];
229
	char path_encoding;
230
231
	/* This is the data for the incoming buffer */
232
	char * incoming_buffer;
233
	int data_read;
234
	int bufsize;
235
236
	/* And this is for the outgoing queue */
237
	pthread_mutex_t send_mutex;
238
239
	/* This is for user mapping */
240
	struct passwd passwd;
241
	unsigned int server_uid, server_gid;
242
	int server_gid_valid;
243
244
	struct afp_server *next;
245
246
	/* These are for DSI attention packets */
247
	unsigned int attention_quantum;
248
	unsigned int attention_len;
249
	char * attention_buffer;
250
251
};
252
253
struct afp_extattr_info {
254
	unsigned int maxsize;
255
	unsigned int size;
256
	char data[1024];
257
};
258
struct afp_comment {
259
	unsigned int maxsize;
260
	unsigned int size;
261
	char *data;
262
};
263
264
struct afp_icon {
265
	unsigned int maxsize;
266
	unsigned int size;
267
	char *data;
268
};
269
270
#define AFP_DEFAULT_ATTENTION_QUANTUM 1024
271
272
void afp_unixpriv_to_stat(struct afp_file_info *fp,
273
	struct stat *stat);
274
275
int init_uams(void) ;
276
277
unsigned int find_uam_by_name(const char * name);
278
char * uam_bitmap_to_string(unsigned int bitmap);
279
280
281
char * get_uam_names_list(void);
282
283
unsigned int default_uams_mask(void);
284
285
struct afp_volume * find_volume_by_name(struct afp_server * server,
286
        const char * volname);
287
288
struct afp_connection_request {
289
        unsigned int uam_mask;
290
	struct afp_url url;
291
};
292
293
void afp_default_url(struct afp_url *url);
294
int afp_parse_url(struct afp_url * url, const char * toparse, int verbose);
295
void afp_print_url(struct afp_url * url);
296
int afp_url_validate(char * url_string, struct afp_url * valid_url);
297
298
int afp_list_volnames(struct afp_server * server, char * names, int max);
299
300
/* User mapping */
301
int afp_detect_mapping(struct afp_volume * volume);
302
303
/* These are some functions that help with simple status text generation */
304
305
int afp_status_header(char * text, int * len);
306
int afp_status_server(struct afp_server * s,char * text, int * len);
307
308
309
struct afp_server * afp_server_full_connect(void * priv, struct afp_connection_request * req);
310
311
void * just_end_it_now(void *other);
312
void add_fd_and_signal(int fd);
313
void loop_disconnect(struct afp_server *s);
314
void afp_wait_for_started_loop(void);
315
316
317
struct afp_versions * pick_version(unsigned char *versions,
318
	unsigned char requested) ;
319
int pick_uam(unsigned int u1, unsigned int u2);
320
321
int afp_server_login(struct afp_server *server,
322
        char * mesg, unsigned int *l, unsigned int max);
323
324
325
int afp_dologin(struct afp_server *server,
326
	unsigned int uam, char * username, char * passwd);
327
328
void afp_free_server(struct afp_server **server);
329
330
struct afp_server * afp_server_init(struct sockaddr_in * address);
331
int afp_get_address(void * priv, const char * hostname, unsigned int port,
332
	struct sockaddr_in * address);
333
334
335
int afp_main_loop(int command_fd);
336
int afp_main_quick_startup(pthread_t * thread);
337
338
int afp_server_destroy(struct afp_server *s) ;
339
int afp_server_reconnect(struct afp_server * s, char * mesg,
340
        unsigned int *l, unsigned int max);
341
int afp_server_connect(struct afp_server *s, int full);
342
343
struct afp_server * afp_server_complete_connection(
344
	void * priv,
345
	struct afp_server * server,
346
	struct sockaddr_in * address, unsigned char * versions,
347
	unsigned int uams, char * username, char * password,
348
	unsigned int requested_version, unsigned int uam_mask);
349
350
int afp_connect_volume(struct afp_volume * volume, struct afp_server * server,
351
	char * mesg, unsigned int * l, unsigned int max);
352
int something_is_mounted(struct afp_server * server);
353
354
int add_cache_entry(struct afp_file_info * file) ;
355
struct afp_file_info * get_cache_by_name(char * name);
356
struct afp_server * find_server_by_address(struct sockaddr_in * address);
357
struct afp_server * find_server_by_signature(char * signature);
358
struct afp_server * find_server_by_name(char * name);
359
int server_still_valid(struct afp_server * server);
360
361
362
struct afp_server * get_server_base(void);
363
int afp_server_remove(struct afp_server * server);
364
365
int afp_unmount_volume(struct afp_volume * volume);
366
int afp_unmount_all_volumes(struct afp_server * server);
367
368
#define volume_is_readonly(x) (((x)->attributes&kReadOnly) || \
369
	((x)->extra_flags & VOLUME_EXTRA_FLAGS_READONLY))
370
371
int afp_opendt(struct afp_volume *volume, unsigned short * refnum);
372
373
int afp_closedt(struct afp_server * server, unsigned short * refnum);
374
375
int afp_getcomment(struct afp_volume *volume, unsigned int did,
376
        const char * pathname, struct afp_comment * comment);
377
378
int afp_addcomment(struct afp_volume *volume, unsigned int did,
379
        const char * pathname, char * comment,uint64_t *size);
380
381
int afp_geticon(struct afp_volume * volume, unsigned int filecreator,
382
        unsigned int filetype, unsigned char icontype, 
383
	unsigned short length, struct afp_icon * icon);
384
385
/* Things you want to do to a server */
386
387
int afp_getsrvrmsg(struct afp_server *server, unsigned short messagetype,unsigned char utf8, unsigned char block, char * mesg);
388
389
int afp_login(struct afp_server *server, char * uaname,
390
        char * userauthinfo, unsigned int userauthinfo_len,
391
	struct afp_rx_buffer *rx);
392
393
int afp_changepassword(struct afp_server *server, char * uaname,
394
        char * userauthinfo, unsigned int userauthinfo_len,
395
	struct afp_rx_buffer *rx);
396
397
int afp_logincont(struct afp_server *server, unsigned short id,
398
        char * userauthinfo, unsigned int userauthinfo_len,
399
	struct afp_rx_buffer *rx);
400
401
int afp_getsessiontoken(struct afp_server * server, int type,
402
        unsigned int timestamp, struct afp_token *outgoing_token,
403
        struct afp_token * incoming_token);
404
405
int afp_getsrvrparms(struct afp_server *server);
406
407
int afp_logout(struct afp_server *server,unsigned char wait);
408
409
int afp_mapname(struct afp_server * server, unsigned char subfunction,
410
        char * name, unsigned int * id);
411
412
int afp_mapid(struct afp_server * server, unsigned char subfunction,
413
	unsigned int id, char *name);
414
415
int afp_getuserinfo(struct afp_server * server, int thisuser,
416
	unsigned int userid, unsigned short bitmap, 
417
	unsigned int *newuid, unsigned int *newgid);
418
419
int afp_zzzzz(struct afp_server *server);
420
421
int afp_volopen(struct afp_volume * volume, 
422
		unsigned short bitmap, char * password);
423
424
int afp_flush(struct afp_volume * volume);
425
426
int afp_getfiledirparms(struct afp_volume *volume, unsigned int did, 
427
	unsigned int filebitmap, unsigned int dirbitmap, const char * pathname,
428
	struct afp_file_info *fp);
429
430
int afp_enumerate(struct afp_volume * volume, 
431
	unsigned int dirid, 
432
	unsigned int filebitmap, unsigned int dirbitmap, 
433
        unsigned short reqcount,
434
        unsigned short startindex,
435
        char * path,
436
	struct afp_file_info ** file_p);
437
438
int afp_enumerateext2(struct afp_volume * volume, 
439
	unsigned int dirid, 
440
	unsigned int filebitmap, unsigned int dirbitmap, 
441
        unsigned short reqcount,
442
        unsigned long startindex,
443
        char * path,
444
	struct afp_file_info ** file_p);
445
446
int afp_openfork(struct afp_volume * volume,
447
        unsigned char forktype,
448
        unsigned int dirid,
449
        unsigned short accessmode,
450
        char * filename, 
451
	struct afp_file_info *fp);
452
453
int afp_read(struct afp_volume * volume, unsigned short forkid,
454
                uint32_t offset,
455
                uint32_t count, struct afp_rx_buffer * rx);
456
457
int afp_readext(struct afp_volume * volume, unsigned short forkid,
458
                uint64_t offset,
459
                uint64_t count, struct afp_rx_buffer * rx);
460
461
int afp_getvolparms(struct afp_volume * volume, unsigned short bitmap);
462
463
464
int afp_createdir(struct afp_volume * volume, unsigned int dirid, const char * pathname, unsigned int *did_p);
465
466
int afp_delete(struct afp_volume * volume,
467
        unsigned int dirid, char * pathname);
468
469
470
int afp_createfile(struct afp_volume * volume, unsigned char flag,
471
        unsigned int did, char * pathname);
472
473
int afp_write(struct afp_volume * volume, unsigned short forkid,
474
        uint32_t offset, uint32_t reqcount,
475
        char * data, uint32_t * written);
476
477
int afp_writeext(struct afp_volume * volume, unsigned short forkid,
478
        uint64_t offset, uint64_t reqcount,
479
        char * data, uint64_t * written);
480
481
int afp_flushfork(struct afp_volume * volume, unsigned short forkid);
482
483
int afp_closefork(struct afp_volume * volume, unsigned short forkid);
484
int afp_setfileparms(struct afp_volume * volume,
485
        unsigned int dirid, const char * pathname, unsigned short bitmap,
486
        struct afp_file_info *fp);
487
int afp_setfiledirparms(struct afp_volume * volume, 
488
        unsigned int dirid, const char * pathname, unsigned short bitmap,
489
        struct afp_file_info *fp);
490
491
int afp_setdirparms(struct afp_volume * volume,
492
        unsigned int dirid, const char * pathname, unsigned short bitmap,
493
        struct afp_file_info *fp);
494
495
int afp_volclose(struct afp_volume * volume);
496
497
498
int afp_setforkparms(struct afp_volume *volume,
499
        unsigned short forkid, unsigned short bitmap, unsigned long len);
500
501
int afp_byterangelock(struct afp_volume * volume,
502
        unsigned char flag,
503
        unsigned short forkid,
504
        uint32_t offset,
505
        uint32_t len, uint32_t *generated_offset);
506
507
int afp_byterangelockext(struct afp_volume * volume,
508
        unsigned char flag,
509
        unsigned short forkid,
510
        uint64_t offset,
511
        uint64_t len, uint64_t *generated_offset);
512
513
int afp_moveandrename(struct afp_volume *volume,
514
	unsigned int src_did,
515
	unsigned int dst_did,
516
	char * src_path, char * dst_path, char *new_name);
517
518
int afp_rename(struct afp_volume * volume,
519
        unsigned int dirid,
520
        char * path_from, char * path_to);
521
522
int afp_listextattr(struct afp_volume * volume,
523
        unsigned int dirid, unsigned short bitmap,
524
        char * pathname, struct afp_extattr_info * info);
525
526
/* This is a currently undocumented command */
527
int afp_newcommand76(struct afp_volume * volume, unsigned int dlen, char * data);
528
529
/* For debugging */
530
char * afp_get_command_name(char code);
531
532
533
#endif
(-)afpfs-ng-0.8.1/include/afpfs-ng/afp_protocol.h (+361 lines)
Line 0 Link Here
1
2
#ifndef _AFP_PROTOCOL_H_
3
#define _AFP_PROTOCOL_H_
4
5
#include <sys/types.h>
6
#include <stddef.h>
7
#include <unistd.h>
8
#include <stdint.h>
9
10
/* This file defines constants for the Apple File Protocol.
11
   All page references are from "Apple Filing Protocol Programming" version 3.2.
12
   except where noted.
13
*/
14
15
#define AFP_SERVER_NAME_LEN 33
16
#define AFP_SERVER_NAME_UTF8_LEN 255
17
#define AFP_VOLUME_NAME_LEN 33
18
#define AFP_VOLUME_NAME_UTF8_LEN 33
19
#define AFP_SIGNATURE_LEN 16
20
#define AFP_MACHINETYPE_LEN 33
21
#define AFP_LOGINMESG_LEN 200
22
#define AFP_VOLPASS_LEN 8
23
#define AFP_HOSTNAME_LEN 255
24
/* This is actually just a guess, and only used for appletalk */
25
#define AFP_ZONE_LEN 255
26
27
#define AFP_SERVER_ICON_LEN 256
28
29
30
#define AFP_MAX_USERNAME_LEN 127
31
#define AFP_MAX_PASSWORD_LEN 127
32
33
34
/* This is the maximum length of any UAM string */
35
#define AFP_UAM_LENGTH 24
36
37
/* This is the maximum length of any path description */
38
#define AFP_MAX_PATH 768
39
40
#define AFP_VOL_FLAT 1
41
#define AFP_VOL_FIXED 2
42
#define AFP_VOL_VARIABLE 3
43
44
/* The root directory ID, p.26 */
45
46
#define AFP_ROOT_DID 2
47
48
/* Path type constants, p.249 */
49
50
enum {
51
kFPShortName = 1,
52
kFPLongName = 2,
53
kFPUTF8Name = 3
54
};
55
56
/* fork types */
57
58
#define AFP_FORKTYPE_DATA 0x0
59
#define AFP_FORKTYPE_RESOURCE 0x80
60
61
/* openfork access modes, from p.196 */
62
63
#define AFP_OPENFORK_ALLOWREAD 1
64
#define AFP_OPENFORK_ALLOWWRITE 2
65
#define AFP_OPENFORK_DENYREAD 0x10
66
#define AFP_OPENFORK_DENYWRITE 0x20
67
68
/* Message type for getsrvmesg, p. 169*/
69
70
typedef enum {
71
  AFPMESG_LOGIN = 0,
72
  AFPMESG_SERVER = 1
73
} afpmessage_t;
74
75
/* Message bitmap for getsrvrmsg */
76
77
#define AFP_GETSRVRMSG_UTF8 0x2
78
#define AFP_GETSRVRMSG_GETMSG 0x1
79
80
81
/* Maximum Version length, p.17 */
82
#define AFP_MAX_VERSION_LENGTH 16
83
84
/* Maximum length of a token, this is undocumented */
85
#define AFP_TOKEN_MAX_LEN 256
86
87
/* The maximum size of a file for AFP 2 */
88
#define AFP_MAX_AFP2_FILESIZE (4294967296)
89
90
/* Unix privs, p.240 */
91
92
struct afp_unixprivs {
93
	uint32_t uid __attribute__((__packed__));
94
	uint32_t gid __attribute__((__packed__));
95
	uint32_t permissions __attribute__((__packed__));
96
	uint32_t ua_permissions __attribute__((__packed__));
97
98
};
99
100
101
/* AFP Volume attributes bitmap, p.241 */
102
103
enum {
104
    kReadOnly = 0x01,
105
    kHasVolumePassword = 0x02,
106
    kSupportsFileIDs = 0x04,
107
    kSupportsCatSearch = 0x08,
108
    kSupportsBlankAccessPrivs = 0x10,
109
    kSupportsUnixPrivs = 0x20,
110
    kSupportsUTF8Names = 0x40,
111
    kNoNetworkUserIDs = 0x80,
112
    kDefaultPrivsFromParent = 0x100,
113
    kNoExchangeFiles = 0x200,
114
    kSupportsExtAttrs = 0x400,
115
    kSupportsACLs=0x800
116
};
117
118
/* AFP file creation constantes, p.250 */
119
enum {
120
kFPSoftCreate = 0,
121
kFPHardCreate = 0x80
122
};
123
124
/* AFP Directory attributes, taken from the protocol guide p.236 */
125
126
enum {
127
    kFPAttributeBit = 0x1,
128
    kFPParentDirIDBit = 0x2,
129
    kFPCreateDateBit = 0x4,
130
    kFPModDateBit = 0x8,
131
    kFPBackupDateBit = 0x10,
132
    kFPFinderInfoBit = 0x20,
133
    kFPLongNameBit = 0x40,
134
    kFPShortNameBit = 0x80,
135
    kFPNodeIDBit = 0x100,
136
    kFPOffspringCountBit = 0x0200,
137
    kFPOwnerIDBit = 0x0400,
138
    kFPGroupIDBit = 0x0800,
139
    kFPAccessRightsBit = 0x1000,
140
    kFPProDOSInfoBit = 0x2000, // AFP version 2.2 and earlier
141
    kFPUTF8NameBit = 0x2000, // AFP version 3.0 and later
142
    kFPUnixPrivsBit = 0x8000 // AFP version 3.0 and later
143
};
144
145
/* AFP File bitmap, p.238.  These are the ones not in the AFP Directory
146
   attributes map. */
147
148
enum {
149
	kFPDataForkLenBit = 0x0200,
150
	kFPRsrcForkLenBit = 0x0400,
151
	kFPExtDataForkLenBit = 0x0800, // AFP version 3.0 and later
152
	kFPLaunchLimitBit = 0x1000,
153
	kFPExtRsrcForkLenBit = 0x4000, // AFP version 3.0 and later
154
};
155
156
/* AFP Extended Attributes Bitmap, p.238  */
157
158
enum {
159
	kXAttrNoFollow = 0x1,
160
	kXAttrCreate = 0x2,
161
	kXAttrREplace=0x4
162
};
163
164
165
/* AFP function codes */
166
enum AFPFunction
167
{
168
        afpByteRangeLock = 1, afpCloseVol, afpCloseDir, afpCloseFork,
169
        afpCopyFile, afpCreateDir, afpCreateFile,
170
        afpDelete, afpEnumerate, afpFlush, afpFlushFork,
171
        afpGetForkParms = 14, afpGetSrvrInfo, afpGetSrvrParms,
172
        afpGetVolParms, afpLogin, afpLoginCont, afpLogout, afpMapID,
173
        afpMapName, afpMoveAndRename, afpOpenVol, afpOpenDir, afpOpenFork,
174
        afpRead, afpRename, afpSetDirParms, afpSetFileParms,
175
        afpSetForkParms, afpSetVolParms, afpWrite, afpGetFileDirParms,
176
	afpSetFileDirParms, afpChangePassword,
177
        afpGetUserInfo=37,afpGetSrvrMsg = 38,
178
	afpOpenDT=48,
179
	afpCloseDT=49,
180
	afpGetIcon=51, afpGetIconInfo=52,
181
	afpAddComment=56, afpRemoveComment=57, afpGetComment=58,
182
	afpByteRangeLockExt=59, afpReadExt, afpWriteExt,
183
	afpGetAuthMethods=62,
184
	afp_LoginExt=63,
185
	afpGetSessionToken=64,
186
	afpDisconnectOldSession=65,
187
	afpEnumerateExt=66,
188
	afpCatSearchExt = 67,
189
	afpEnumerateExt2 = 68, afpGetExtAttr, afpSetExtAttr, 
190
	afpRemoveExtAttr , afpListExtAttrs,
191
	afpZzzzz = 122,
192
	afpAddIcon=192,
193
};
194
195
/* AFP Volume bitmap.  Take from 242 of the protocol guide. */
196
enum {
197
	kFPBadVolPre222Bitmap = 0xFe00,
198
	kFPBadVolBitmap = 0xF000,
199
	kFPVolAttributeBit = 0x1,
200
	kFPVolSignatureBit = 0x2,
201
	kFPVolCreateDateBit = 0x4,
202
	kFPVolModDateBit = 0x8,
203
	kFPVolBackupDateBit = 0x10,
204
	kFPVolIDBit = 0x20,
205
	kFPVolBytesFreeBit = 0x40,
206
	kFPVolBytesTotalBit = 0x80,
207
	kFPVolNameBit = 0x100,
208
	kFPVolExtBytesFreeBit = 0x200,
209
	kFPVolExtBytesTotalBit = 0x400,
210
	kFPVolBlockSizeBit = 0x800
211
};
212
213
/* AFP Attention Codes -- 4 bits */
214
#define AFPATTN_SHUTDOWN     (1 << 15)            /* shutdown/disconnect */
215
#define AFPATTN_CRASH        (1 << 14)            /* server crashed */
216
#define AFPATTN_MESG         (1 << 13)            /* server has message */
217
#define AFPATTN_NORECONNECT  (1 << 12)            /* don't reconnect */
218
/* server notification */
219
#define AFPATTN_NOTIFY       (AFPATTN_MESG | AFPATTN_NORECONNECT) 
220
221
/* extended bitmap -- 12 bits. volchanged is only useful w/ a server
222
 * notification, and time is only useful for shutdown. */
223
#define AFPATTN_VOLCHANGED   (1 << 0)             /* volume has changed */
224
#define AFPATTN_TIME(x)      ((x) & 0xfff)        /* time in minutes */
225
226
#define kFPNoErr 0
227
228
/* AFP result codes, p252 */
229
#define kASPSessClosed -1072
230
#define kFPAccessDenied -5000
231
#define kFPAuthContinue -5001
232
#define kFPBadUAM -5002
233
#define kFPBadVersNum -5003
234
#define kFPBitmapErr -5004
235
#define kFPCantMove -5005
236
#define kFPDenyConflict -5006
237
#define kFPDirNotEmpty -5007
238
#define kFPDiskFull -5008
239
#define kFPEOFErr -5009
240
#define kFPFileBusy -5010
241
#define kFPFlatVol -5011
242
#define kFPItemNotFound -5012
243
#define kFPLockErr -5013
244
#define kFPMiscErr -5014
245
#define kFPNoMoreLocks -5015
246
#define kFPNoServer -5016
247
#define kFPObjectExists -5017
248
#define kFPObjectNotFound -5018
249
#define kFPParamErr -5019
250
#define kFPRangeNotLocked -5020
251
#define kFPRangeOverlap -5021
252
#define kFPSessClosed -5022
253
#define kFPUserNotAuth -5023
254
#define kFPCallNotSupported -5024
255
#define kFPObjectTypeErr -5025
256
#define kFPTooManyFilesOpen -5026
257
#define kFPServerGoingDown -5027
258
#define kFPCantRename -5028
259
#define kFPDirNotFound -5029
260
#define kFPIconTypeError -5030
261
#define kFPVolLocked -5031
262
#define kFPObjectLocked -5032
263
#define kFPContainsSharedErr -5033
264
#define kFPIDNotFound -5034
265
#define kFPIDExists -5035
266
#define kFPDiffVolErr  -5036
267
#define kFPCatalogChanged -5037
268
#define kFPSameObjectErr -5038
269
#define kFPBadIDErr -5039
270
#define kFPPwdSameErr -5040
271
#define kFPPwdTooShortErr -5041
272
#define kFPPwdExpiredErr -5042
273
#define kFPInsideSharedErr -5043
274
#define kFPInsideTrashErr -5044
275
#define kFPPwdNeedsChangeErr -5045
276
#define kFPPwdPolicyErr -5046
277
#define kFPDiskQuotaExceeded –5047 
278
279
280
281
/* These flags determine to lock or unlock in ByteRangeLock(Ext) */
282
283
enum {
284
ByteRangeLock_Lock = 0,
285
ByteRangeLock_Unlock = 1
286
};
287
288
/* These flags are used in volopen and getsrvrparm replies, p.171 */
289
290
#define HasConfigInfo 0x1
291
#define HasPassword 0x80
292
293
/* These are the subfunction for kFPMapID, as per p.248 */
294
295
enum {
296
kUserIDToName = 1,
297
kGroupIDToName = 2,
298
kUserIDToUTF8Name = 3,
299
kGroupIDToUTF8Name = 4,
300
kUserUUIDToUTF8Name = 5,
301
kGroupUUIDToUTF8Name = 6
302
};
303
304
305
/* These are the subfunction flags described in the FPMapName command, p.286.
306
   Note that this is different than what's described on p. 186. */
307
308
enum {
309
kNameToUserID = 1,
310
kNameToGroupID = 2,
311
kUTF8NameToUserID = 3,
312
kUTF8NameToGroupID = 4,
313
kUTF8NameToUserUUID = 5,
314
kUTF8NameToGroupUUID = 6
315
};
316
317
/* These are bits for FPGetUserInfo, p.173. */
318
#define kFPGetUserInfo_USER_ID 1
319
#define kFPGetUserInfo_PRI_GROUPID 2
320
321
/* Flags for the replies of GetSrvrInfo and DSI GetStatus, p.240 */
322
323
enum {
324
	kSupportsCopyfile = 0x01,
325
	kSupportsChgPwd = 0x02,
326
	kDontAllowSavePwd = 0x04,
327
	kSupportsSrvrMsg = 0x08,
328
	kSrvrSig = 0x10,
329
	kSupportsTCP = 0x20,
330
	kSupportsSrvrNotify = 0x40,
331
	kSupportsReconnect = 0x80,
332
	kSupportsDirServices = 0x100,
333
	kSupportsUTF8SrvrName = 0x200,
334
	kSupportsUUIDs = 0x400,
335
	kSupportsSuperClient = 0x8000
336
};
337
338
339
/* p.247 */
340
341
enum {
342
	kLoginWithoutID = 0,
343
	kLoginWithID = 1,
344
	kReconnWithID = 2,
345
	kLoginWithTimeAndID = 3,
346
	kReconnWithTimeAndID = 4,
347
	kRecon1Login = 5,
348
	kRecon1ReconnectLogin = 6,
349
	kRecon1Refresh = 7, kGetKerberosSessionKey = 8
350
};
351
352
353
#define AFP_CHMOD_ALLOWED_BITS_22 \
354
	(S_IRUSR |S_IWUSR | S_IRGRP | S_IWGRP |S_IROTH | S_IWOTH | S_IFREG )
355
356
357
#endif
358
359
360
361
(-)afpfs-ng-0.8.1/include/afpfs-ng/codepage.h (+11 lines)
Line 0 Link Here
1
#ifndef __CODE_PAGE_H_
2
#define __CODE_PAGE_H_
3
int convert_utf8dec_to_utf8pre(const char *src, int src_len,
4
	char * dest, int dest_len);
5
int convert_utf8pre_to_utf8dec(const char * src, int src_len, 
6
	char * dest, int dest_len);
7
int convert_path_to_unix(char encoding, char * dest, 
8
	char * src, int dest_len);
9
int convert_path_to_afp(char encoding, char * dest, 
10
	char * src, int dest_len);
11
#endif
(-)afpfs-ng-0.8.1/include/afpfs-ng/dsi.h (+33 lines)
Line 0 Link Here
1
2
#ifndef __DSI_H_
3
#define __DSI_H_
4
5
#include "afpfs-ng/afp.h"
6
7
struct dsi_request
8
{
9
	unsigned short requestid;
10
	unsigned char subcommand;
11
	void * other;
12
	unsigned char wait;
13
	pthread_cond_t  condition_cond;
14
	struct dsi_request * next;
15
	int return_code;
16
};
17
18
int dsi_receive(struct afp_server * server, void * data, int size);
19
int dsi_getstatus(struct afp_server * server);
20
21
int dsi_opensession(struct afp_server *server);
22
23
int dsi_send(struct afp_server *server, char * msg, int size,int wait,unsigned char subcommand, void ** other);
24
struct dsi_session * dsi_create(struct afp_server *server);
25
int dsi_restart(struct afp_server *server);
26
int dsi_recv(struct afp_server * server);
27
28
#define DSI_BLOCK_TIMEOUT -1
29
#define DSI_DONT_WAIT 0
30
#define DSI_DEFAULT_TIMEOUT 5
31
32
33
#endif
(-)afpfs-ng-0.8.1/include/afpfs-ng/libafpclient.h (+50 lines)
Line 0 Link Here
1
2
#ifndef __CLIENT_H_
3
#define __CLIENT_H_
4
5
#include <unistd.h>
6
#include <syslog.h>
7
8
#define MAX_CLIENT_RESPONSE 2048
9
10
11
enum loglevels {
12
        AFPFSD,
13
};
14
15
struct afp_server;
16
struct afp_volume;
17
18
struct libafpclient {
19
        int (*unmount_volume) (struct afp_volume * volume);
20
	void (*log_for_client)(void * priv,
21
        	enum loglevels loglevel, int logtype, const char *message);
22
	void (*forced_ending_hook)(void);
23
	int (*scan_extra_fds)(int command_fd,fd_set *set, int * max_fd);
24
	void (*loop_started)(void);
25
} ;
26
27
extern struct libafpclient * libafpclient;
28
29
void libafpclient_register(struct libafpclient * tmpclient);
30
31
32
void signal_main_thread(void);
33
34
/* These are logging functions */
35
36
#define MAXLOGSIZE 2048
37
38
#define LOG_METHOD_SYSLOG 1
39
#define LOG_METHOD_STDOUT 2
40
41
void set_log_method(int m);
42
43
44
void log_for_client(void * priv,
45
        enum loglevels loglevel, int logtype, char * message,...);
46
47
void stdout_log_for_client(void * priv,
48
	enum loglevels loglevel, int logtype, const char *message);
49
50
#endif
(-)afpfs-ng-0.8.1/include/afpfs-ng/Makefile.am (+6 lines)
Line 0 Link Here
1
## Process this file with automake to produce Makefile.in
2
3
afpfsincludedir = $(includedir)/afpfs-ng
4
5
afpfsinclude_HEADERS = afp.h afp_protocol.h libafpclient.h
6
nodist_afpfsinclude_HEADERS =  codepage.h dsi.h  map_def.h midlevel.h uams_def.h utils.h
(-)afpfs-ng-0.8.1/include/afpfs-ng/map_def.h (+15 lines)
Line 0 Link Here
1
#ifndef __MAP_H_
2
#define __MAP_H_
3
4
#include "afpfs-ng/afp.h"
5
6
#define AFP_MAPPING_UNKNOWN 0
7
#define AFP_MAPPING_COMMON 1
8
#define AFP_MAPPING_LOGINIDS 2
9
#define AFP_MAPPING_NAME 3
10
11
unsigned int map_string_to_num(char * name);
12
char * get_mapping_name(struct afp_volume * volume);
13
14
15
#endif
(-)afpfs-ng-0.8.1/include/afpfs-ng/midlevel.h (+64 lines)
Line 0 Link Here
1
#ifndef __MIDLEVEL_H_
2
#define __MIDLEVEL_H_ 
3
4
#include <utime.h>
5
#include "afpfs-ng/afp.h"
6
7
int ml_open(struct afp_volume * volume, const char *path, int flags, 
8
        struct afp_file_info **newfp);
9
10
int ml_creat(struct afp_volume * volume, const char *path,mode_t mode);
11
12
int ml_readdir(struct afp_volume * volume, 
13
	const char *path, 
14
	struct afp_file_info **base);
15
16
int ml_read(struct afp_volume * volume, const char *path,
17
	char *buf, size_t size, off_t offset,
18
	struct afp_file_info *fp, int * eof);
19
20
int ml_chmod(struct afp_volume * vol, const char * path, mode_t mode);
21
22
int ml_unlink(struct afp_volume * vol, const char *path);
23
24
int ml_mkdir(struct afp_volume * vol, const char * path, mode_t mode);
25
26
int ml_close(struct afp_volume * volume, const char * path,
27
        struct afp_file_info * fp);
28
29
int ml_getattr(struct afp_volume * volume, const char *path, 
30
	struct stat *stbuf);
31
32
int ml_write(struct afp_volume * volume, const char * path, 
33
	const char *data, size_t size, off_t offset,
34
	struct afp_file_info * fp, uid_t uid,
35
	gid_t gid);
36
37
int ml_readlink(struct afp_volume * vol, const char * path,
38
        char *buf, size_t size);
39
40
int ml_rmdir(struct afp_volume * vol, const char *path);
41
42
int ml_chown(struct afp_volume * vol, const char * path,   
43
        uid_t uid, gid_t gid);
44
45
int ml_truncate(struct afp_volume * vol, const char * path, off_t offset);
46
47
int ml_utime(struct afp_volume * vol, const char * path,
48
	struct utimbuf * timebuf);
49
50
int ml_symlink(struct afp_volume *vol, const char * path1, const char * path2);
51
52
int ml_rename(struct afp_volume * vol,
53
	const char * path_from, const char * path_to);
54
55
int ml_statfs(struct afp_volume * vol, const char *path, struct statvfs *stat);
56
57
void afp_ml_filebase_free(struct afp_file_info **filebase);
58
59
int ml_passwd(struct afp_server *server,
60
                char * username, char * oldpasswd, char * newpasswd);
61
62
63
64
#endif
(-)afpfs-ng-0.8.1/include/afpfs-ng/uams_def.h (+16 lines)
Line 0 Link Here
1
#ifndef __UAM_DEFS_H_
2
#define __UAM_DEFS_H_
3
4
#define UAM_NOUSERAUTHENT 0x1
5
#define UAM_CLEARTXTPASSWRD 0x2
6
#define UAM_RANDNUMEXCHANGE 0x4
7
#define UAM_2WAYRANDNUM 0x8
8
#define UAM_DHCAST128 0x10
9
#define UAM_CLIENTKRB 0x20
10
#define UAM_DHX2 0x40
11
#define UAM_RECON1 0x80
12
13
int uam_string_to_bitmap(char * name);
14
char * uam_bitmap_to_string(unsigned int bitmap);
15
16
#endif
(-)afpfs-ng-0.8.1/include/afpfs-ng/utils.h (+43 lines)
Line 0 Link Here
1
#ifndef __UTILS_H_
2
#define __UTILS_H_
3
#include <stdio.h>
4
5
#include "afpfs-ng/afp.h"
6
7
#if BYTE_ORDER == BIG_ENDIAN
8
#define hton64(x)       (x)
9
#define ntoh64(x)       (x)
10
#else /* BYTE_ORDER == BIG_ENDIAN */
11
#define hton64(x)       ((u_int64_t) (htonl(((x) >> 32) & 0xffffffffLL)) | \
12
                         (u_int64_t) ((htonl(x) & 0xffffffffLL) << 32))
13
#define ntoh64(x)       (hton64(x))
14
#endif /* BYTE_ORDER == BIG_ENDIAN */
15
16
#define min(a,b) (((a)<(b)) ? (a) : (b))
17
#define max(a,b) (((a)>(b)) ? (a) : (b))
18
19
20
21
unsigned char unixpath_to_afppath(
22
        struct afp_server * server,
23
        char * buf);
24
25
unsigned char sizeof_path_header(struct afp_server * server);
26
27
28
29
unsigned char copy_from_pascal(char *dest, char *pascal,unsigned int max_len) ;
30
unsigned short copy_from_pascal_two(char *dest, char *pascal,unsigned int max_len);
31
32
unsigned char copy_to_pascal(char *dest, const char *src);
33
unsigned short copy_to_pascal_two(char *dest, const char *src);
34
35
void copy_path(struct afp_server * server, char * dest, const char * pathname, unsigned char len);
36
37
38
char * create_path(struct afp_server * server, char * pathname, unsigned short * len);
39
40
41
int invalid_filename(struct afp_server * server, const char * filename);
42
43
#endif
(-)afpfs-ng-0.8.1/include/afp.h (-533 lines)
Lines 1-533 Link Here
1
2
#ifndef _AFP_H_
3
#define _AFP_H_
4
5
#include <arpa/inet.h>
6
#include <pthread.h>
7
#include <netdb.h>
8
#include <sys/statvfs.h>
9
#include <pwd.h>
10
#include <afp_protocol.h>
11
#include <libafpclient.h>
12
#include <sys/types.h>
13
#include <sys/stat.h>
14
#include <unistd.h>
15
#include <netinet/in.h>
16
17
18
#define AFPFS_VERSION "0.8.1"
19
20
/* This is the maximum AFP version this library supports */
21
#define AFP_MAX_SUPPORTED_VERSION 32
22
23
/* afp_url is used to pass locations around */
24
struct afp_url {
25
	enum {TCPIP,AT} protocol;
26
	char username[AFP_MAX_USERNAME_LEN];
27
	char uamname[50];
28
	char password[AFP_MAX_PASSWORD_LEN];
29
	char servername[AFP_SERVER_NAME_UTF8_LEN];
30
	int port;
31
	char volumename[AFP_VOLUME_NAME_UTF8_LEN];
32
	char path[AFP_MAX_PATH];
33
34
	int requested_version;
35
	char zone[AFP_ZONE_LEN]; /* Only used for Appletalk */
36
	char volpassword[9];;
37
};
38
39
struct afp_token {
40
	unsigned int length;
41
	char data[AFP_TOKEN_MAX_LEN];
42
};
43
44
#define SERVER_MAX_VERSIONS 10
45
#define SERVER_MAX_UAMS 10
46
47
struct afp_rx_buffer {
48
	unsigned int size;
49
	unsigned int maxsize;
50
	char * data;
51
	int errorcode;
52
};
53
54
55
struct afp_file_info {
56
	unsigned short attributes;
57
	unsigned int did;
58
	unsigned int creation_date;
59
	unsigned int modification_date;
60
	unsigned int backup_date;
61
	unsigned int fileid;
62
	unsigned short offspring;
63
	char sync;
64
	char finderinfo[32];
65
	char name[AFP_MAX_PATH];
66
	char basename[AFP_MAX_PATH];
67
	char translated_name[AFP_MAX_PATH];
68
	struct afp_unixprivs unixprivs;
69
	unsigned int accessrights;
70
	struct afp_file_info * next;
71
	struct afp_file_info * largelist_next;
72
	unsigned char isdir;
73
	unsigned long long size;
74
	unsigned short resourcesize;
75
	unsigned int resource;
76
	unsigned short forkid;
77
	struct afp_icon * icon;
78
	int eof;
79
};
80
81
82
#define VOLUME_EXTRA_FLAGS_VOL_CHMOD_KNOWN 0x1
83
#define VOLUME_EXTRA_FLAGS_VOL_CHMOD_BROKEN 0x2
84
#define VOLUME_EXTRA_FLAGS_SHOW_APPLEDOUBLE 0x4
85
#define VOLUME_EXTRA_FLAGS_VOL_SUPPORTS_UNIX 0x8
86
#define VOLUME_EXTRA_FLAGS_NO_LOCKING 0x10
87
#define VOLUME_EXTRA_FLAGS_IGNORE_UNIXPRIVS 0x20
88
#define VOLUME_EXTRA_FLAGS_READONLY 0x40
89
90
#define AFP_VOLUME_UNMOUNTED 0
91
#define AFP_VOLUME_MOUNTED 1
92
#define AFP_VOLUME_UNMOUNTING 2
93
94
struct afp_volume {
95
	unsigned short volid;
96
	char flags;  /* This is from afpGetSrvrParms */
97
	unsigned short attributes; /* This is from VolOpen */
98
	unsigned short signature;  /* This is fixed or variable */
99
	unsigned int creation_date;
100
	unsigned int modification_date;
101
	unsigned int backup_date;
102
	struct statvfs stat;
103
	unsigned char mounted;
104
	char mountpoint[255];
105
	struct afp_server * server;
106
	char volume_name[AFP_VOLUME_NAME_LEN];
107
	char volume_name_printable[AFP_VOLUME_NAME_UTF8_LEN];
108
	unsigned short dtrefnum;
109
	char volpassword[AFP_VOLPASS_LEN];
110
	unsigned int extra_flags; /* This is an afpfs-ng specific field */
111
112
	/* Our directory ID cache */
113
	struct did_cache_entry * did_cache_base;
114
	pthread_mutex_t did_cache_mutex;
115
116
	/* Our journal of open forks */
117
	struct afp_file_info * open_forks;
118
	pthread_mutex_t open_forks_mutex;
119
120
	/* Used to trigger startup */
121
        pthread_cond_t  startup_condition_cond;
122
123
	struct {
124
		uint64_t hits;
125
		uint64_t misses;
126
		uint64_t expired;
127
		uint64_t force_removed;
128
	} did_cache_stats;
129
130
	void * priv;  /* This is a private structure for fuse/cmdline, etc */
131
	pthread_t thread; /* This is the per-volume thread */
132
133
	int mapping;
134
135
};
136
137
#define SERVER_STATE_CONNECTED 1
138
#define SERVER_STATE_DISCONNECTED 2
139
140
enum server_type{
141
	AFPFS_SERVER_TYPE_UNKNOWN,
142
	AFPFS_SERVER_TYPE_NETATALK,
143
	AFPFS_SERVER_TYPE_AIRPORT,
144
	AFPFS_SERVER_TYPE_MACINTOSH,
145
};
146
147
#define is_netatalk(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_NETATALK )
148
#define is_airport(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_AIRPORT )
149
#define is_macintosh(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_MACINTOSH )
150
151
152
153
struct afp_versions {
154
        char        *av_name;
155
        int         av_number;
156
};
157
extern struct afp_versions afp_versions[];
158
159
struct afp_server {
160
161
	/* Our buffer sizes */
162
	unsigned int tx_quantum;
163
	unsigned int rx_quantum;
164
165
	unsigned int tx_delay;
166
167
	/* Connection information */
168
	struct sockaddr_in address;
169
	int fd;
170
171
	/* Some stats, for information only */
172
	struct {
173
		uint64_t runt_packets;
174
		uint64_t incoming_dsi;
175
		uint64_t rx_bytes;
176
		uint64_t tx_bytes;
177
		uint64_t requests_pending;
178
	} stats;
179
180
	/* General information */
181
	char server_name[AFP_SERVER_NAME_LEN];
182
	char server_name_utf8[AFP_SERVER_NAME_UTF8_LEN];
183
        char server_name_printable[AFP_SERVER_NAME_UTF8_LEN];
184
185
	char machine_type[17];
186
	char icon[256];
187
	char signature[16];
188
	unsigned short flags;
189
	int connect_state;
190
	enum server_type server_type;
191
192
	/* This is the time we connected */
193
	time_t connect_time;
194
195
	/* UAMs */
196
	unsigned int supported_uams;
197
	unsigned int using_uam;
198
199
	/* Authentication */
200
	char username[AFP_MAX_USERNAME_LEN];
201
	char password[AFP_MAX_PASSWORD_LEN];
202
203
	/* Session */
204
	struct afp_token token;
205
	char need_resume;
206
207
	/* Versions */
208
	unsigned char requested_version;
209
	unsigned char versions[SERVER_MAX_VERSIONS];
210
	struct afp_versions *using_version;
211
212
	/* Volumes */
213
	unsigned char num_volumes;
214
	struct afp_volume * volumes;
215
216
	void * dsi;
217
	unsigned int exit_flag;
218
219
	/* Our DSI request queue */
220
	pthread_mutex_t requestid_mutex;
221
	pthread_mutex_t request_queue_mutex;
222
	unsigned short lastrequestid;
223
	unsigned short expectedrequestid;
224
	struct dsi_request * command_requests;
225
226
227
	char loginmesg[200];
228
	char servermesg[200];
229
	char path_encoding;
230
231
	/* This is the data for the incoming buffer */
232
	char * incoming_buffer;
233
	int data_read;
234
	int bufsize;
235
236
	/* And this is for the outgoing queue */
237
	pthread_mutex_t send_mutex;
238
239
	/* This is for user mapping */
240
	struct passwd passwd;
241
	unsigned int server_uid, server_gid;
242
	int server_gid_valid;
243
244
	struct afp_server *next;
245
246
	/* These are for DSI attention packets */
247
	unsigned int attention_quantum;
248
	unsigned int attention_len;
249
	char * attention_buffer;
250
251
};
252
253
struct afp_extattr_info {
254
	unsigned int maxsize;
255
	unsigned int size;
256
	char data[1024];
257
};
258
struct afp_comment {
259
	unsigned int maxsize;
260
	unsigned int size;
261
	char *data;
262
};
263
264
struct afp_icon {
265
	unsigned int maxsize;
266
	unsigned int size;
267
	char *data;
268
};
269
270
#define AFP_DEFAULT_ATTENTION_QUANTUM 1024
271
272
void afp_unixpriv_to_stat(struct afp_file_info *fp,
273
	struct stat *stat);
274
275
int init_uams(void) ;
276
277
unsigned int find_uam_by_name(const char * name);
278
char * uam_bitmap_to_string(unsigned int bitmap);
279
280
281
char * get_uam_names_list(void);
282
283
unsigned int default_uams_mask(void);
284
285
struct afp_volume * find_volume_by_name(struct afp_server * server,
286
        const char * volname);
287
288
struct afp_connection_request {
289
        unsigned int uam_mask;
290
	struct afp_url url;
291
};
292
293
void afp_default_url(struct afp_url *url);
294
int afp_parse_url(struct afp_url * url, const char * toparse, int verbose);
295
void afp_print_url(struct afp_url * url);
296
int afp_url_validate(char * url_string, struct afp_url * valid_url);
297
298
int afp_list_volnames(struct afp_server * server, char * names, int max);
299
300
/* User mapping */
301
int afp_detect_mapping(struct afp_volume * volume);
302
303
/* These are some functions that help with simple status text generation */
304
305
int afp_status_header(char * text, int * len);
306
int afp_status_server(struct afp_server * s,char * text, int * len);
307
308
309
struct afp_server * afp_server_full_connect(void * priv, struct afp_connection_request * req);
310
311
void * just_end_it_now(void *other);
312
void add_fd_and_signal(int fd);
313
void loop_disconnect(struct afp_server *s);
314
void afp_wait_for_started_loop(void);
315
316
317
struct afp_versions * pick_version(unsigned char *versions,
318
	unsigned char requested) ;
319
int pick_uam(unsigned int u1, unsigned int u2);
320
321
int afp_server_login(struct afp_server *server,
322
        char * mesg, unsigned int *l, unsigned int max);
323
324
325
int afp_dologin(struct afp_server *server,
326
	unsigned int uam, char * username, char * passwd);
327
328
void afp_free_server(struct afp_server **server);
329
330
struct afp_server * afp_server_init(struct sockaddr_in * address);
331
int afp_get_address(void * priv, const char * hostname, unsigned int port,
332
	struct sockaddr_in * address);
333
334
335
int afp_main_loop(int command_fd);
336
int afp_main_quick_startup(pthread_t * thread);
337
338
int afp_server_destroy(struct afp_server *s) ;
339
int afp_server_reconnect(struct afp_server * s, char * mesg,
340
        unsigned int *l, unsigned int max);
341
int afp_server_connect(struct afp_server *s, int full);
342
343
struct afp_server * afp_server_complete_connection(
344
	void * priv,
345
	struct afp_server * server,
346
	struct sockaddr_in * address, unsigned char * versions,
347
	unsigned int uams, char * username, char * password,
348
	unsigned int requested_version, unsigned int uam_mask);
349
350
int afp_connect_volume(struct afp_volume * volume, struct afp_server * server,
351
	char * mesg, unsigned int * l, unsigned int max);
352
int something_is_mounted(struct afp_server * server);
353
354
int add_cache_entry(struct afp_file_info * file) ;
355
struct afp_file_info * get_cache_by_name(char * name);
356
struct afp_server * find_server_by_address(struct sockaddr_in * address);
357
struct afp_server * find_server_by_signature(char * signature);
358
struct afp_server * find_server_by_name(char * name);
359
int server_still_valid(struct afp_server * server);
360
361
362
struct afp_server * get_server_base(void);
363
int afp_server_remove(struct afp_server * server);
364
365
int afp_unmount_volume(struct afp_volume * volume);
366
int afp_unmount_all_volumes(struct afp_server * server);
367
368
#define volume_is_readonly(x) (((x)->attributes&kReadOnly) || \
369
	((x)->extra_flags & VOLUME_EXTRA_FLAGS_READONLY))
370
371
int afp_opendt(struct afp_volume *volume, unsigned short * refnum);
372
373
int afp_closedt(struct afp_server * server, unsigned short * refnum);
374
375
int afp_getcomment(struct afp_volume *volume, unsigned int did,
376
        const char * pathname, struct afp_comment * comment);
377
378
int afp_addcomment(struct afp_volume *volume, unsigned int did,
379
        const char * pathname, char * comment,uint64_t *size);
380
381
int afp_geticon(struct afp_volume * volume, unsigned int filecreator,
382
        unsigned int filetype, unsigned char icontype, 
383
	unsigned short length, struct afp_icon * icon);
384
385
/* Things you want to do to a server */
386
387
int afp_getsrvrmsg(struct afp_server *server, unsigned short messagetype,unsigned char utf8, unsigned char block, char * mesg);
388
389
int afp_login(struct afp_server *server, char * uaname,
390
        char * userauthinfo, unsigned int userauthinfo_len,
391
	struct afp_rx_buffer *rx);
392
393
int afp_changepassword(struct afp_server *server, char * uaname,
394
        char * userauthinfo, unsigned int userauthinfo_len,
395
	struct afp_rx_buffer *rx);
396
397
int afp_logincont(struct afp_server *server, unsigned short id,
398
        char * userauthinfo, unsigned int userauthinfo_len,
399
	struct afp_rx_buffer *rx);
400
401
int afp_getsessiontoken(struct afp_server * server, int type,
402
        unsigned int timestamp, struct afp_token *outgoing_token,
403
        struct afp_token * incoming_token);
404
405
int afp_getsrvrparms(struct afp_server *server);
406
407
int afp_logout(struct afp_server *server,unsigned char wait);
408
409
int afp_mapname(struct afp_server * server, unsigned char subfunction,
410
        char * name, unsigned int * id);
411
412
int afp_mapid(struct afp_server * server, unsigned char subfunction,
413
	unsigned int id, char *name);
414
415
int afp_getuserinfo(struct afp_server * server, int thisuser,
416
	unsigned int userid, unsigned short bitmap, 
417
	unsigned int *newuid, unsigned int *newgid);
418
419
int afp_zzzzz(struct afp_server *server);
420
421
int afp_volopen(struct afp_volume * volume, 
422
		unsigned short bitmap, char * password);
423
424
int afp_flush(struct afp_volume * volume);
425
426
int afp_getfiledirparms(struct afp_volume *volume, unsigned int did, 
427
	unsigned int filebitmap, unsigned int dirbitmap, const char * pathname,
428
	struct afp_file_info *fp);
429
430
int afp_enumerate(struct afp_volume * volume, 
431
	unsigned int dirid, 
432
	unsigned int filebitmap, unsigned int dirbitmap, 
433
        unsigned short reqcount,
434
        unsigned short startindex,
435
        char * path,
436
	struct afp_file_info ** file_p);
437
438
int afp_enumerateext2(struct afp_volume * volume, 
439
	unsigned int dirid, 
440
	unsigned int filebitmap, unsigned int dirbitmap, 
441
        unsigned short reqcount,
442
        unsigned long startindex,
443
        char * path,
444
	struct afp_file_info ** file_p);
445
446
int afp_openfork(struct afp_volume * volume,
447
        unsigned char forktype,
448
        unsigned int dirid,
449
        unsigned short accessmode,
450
        char * filename, 
451
	struct afp_file_info *fp);
452
453
int afp_read(struct afp_volume * volume, unsigned short forkid,
454
                uint32_t offset,
455
                uint32_t count, struct afp_rx_buffer * rx);
456
457
int afp_readext(struct afp_volume * volume, unsigned short forkid,
458
                uint64_t offset,
459
                uint64_t count, struct afp_rx_buffer * rx);
460
461
int afp_getvolparms(struct afp_volume * volume, unsigned short bitmap);
462
463
464
int afp_createdir(struct afp_volume * volume, unsigned int dirid, const char * pathname, unsigned int *did_p);
465
466
int afp_delete(struct afp_volume * volume,
467
        unsigned int dirid, char * pathname);
468
469
470
int afp_createfile(struct afp_volume * volume, unsigned char flag,
471
        unsigned int did, char * pathname);
472
473
int afp_write(struct afp_volume * volume, unsigned short forkid,
474
        uint32_t offset, uint32_t reqcount,
475
        char * data, uint32_t * written);
476
477
int afp_writeext(struct afp_volume * volume, unsigned short forkid,
478
        uint64_t offset, uint64_t reqcount,
479
        char * data, uint64_t * written);
480
481
int afp_flushfork(struct afp_volume * volume, unsigned short forkid);
482
483
int afp_closefork(struct afp_volume * volume, unsigned short forkid);
484
int afp_setfileparms(struct afp_volume * volume,
485
        unsigned int dirid, const char * pathname, unsigned short bitmap,
486
        struct afp_file_info *fp);
487
int afp_setfiledirparms(struct afp_volume * volume, 
488
        unsigned int dirid, const char * pathname, unsigned short bitmap,
489
        struct afp_file_info *fp);
490
491
int afp_setdirparms(struct afp_volume * volume,
492
        unsigned int dirid, const char * pathname, unsigned short bitmap,
493
        struct afp_file_info *fp);
494
495
int afp_volclose(struct afp_volume * volume);
496
497
498
int afp_setforkparms(struct afp_volume *volume,
499
        unsigned short forkid, unsigned short bitmap, unsigned long len);
500
501
int afp_byterangelock(struct afp_volume * volume,
502
        unsigned char flag,
503
        unsigned short forkid,
504
        uint32_t offset,
505
        uint32_t len, uint32_t *generated_offset);
506
507
int afp_byterangelockext(struct afp_volume * volume,
508
        unsigned char flag,
509
        unsigned short forkid,
510
        uint64_t offset,
511
        uint64_t len, uint64_t *generated_offset);
512
513
int afp_moveandrename(struct afp_volume *volume,
514
	unsigned int src_did,
515
	unsigned int dst_did,
516
	char * src_path, char * dst_path, char *new_name);
517
518
int afp_rename(struct afp_volume * volume,
519
        unsigned int dirid,
520
        char * path_from, char * path_to);
521
522
int afp_listextattr(struct afp_volume * volume,
523
        unsigned int dirid, unsigned short bitmap,
524
        char * pathname, struct afp_extattr_info * info);
525
526
/* This is a currently undocumented command */
527
int afp_newcommand76(struct afp_volume * volume, unsigned int dlen, char * data);
528
529
/* For debugging */
530
char * afp_get_command_name(char code);
531
532
533
#endif
(-)afpfs-ng-0.8.1/include/afp_protocol.h (-361 lines)
Lines 1-361 Link Here
1
2
#ifndef _AFP_PROTOCOL_H_
3
#define _AFP_PROTOCOL_H_
4
5
#include <sys/types.h>
6
#include <stddef.h>
7
#include <unistd.h>
8
#include <stdint.h>
9
10
/* This file defines constants for the Apple File Protocol.
11
   All page references are from "Apple Filing Protocol Programming" version 3.2.
12
   except where noted.
13
*/
14
15
#define AFP_SERVER_NAME_LEN 33
16
#define AFP_SERVER_NAME_UTF8_LEN 255
17
#define AFP_VOLUME_NAME_LEN 33
18
#define AFP_VOLUME_NAME_UTF8_LEN 33
19
#define AFP_SIGNATURE_LEN 16
20
#define AFP_MACHINETYPE_LEN 33
21
#define AFP_LOGINMESG_LEN 200
22
#define AFP_VOLPASS_LEN 8
23
#define AFP_HOSTNAME_LEN 255
24
/* This is actually just a guess, and only used for appletalk */
25
#define AFP_ZONE_LEN 255
26
27
#define AFP_SERVER_ICON_LEN 256
28
29
30
#define AFP_MAX_USERNAME_LEN 127
31
#define AFP_MAX_PASSWORD_LEN 127
32
33
34
/* This is the maximum length of any UAM string */
35
#define AFP_UAM_LENGTH 24
36
37
/* This is the maximum length of any path description */
38
#define AFP_MAX_PATH 768
39
40
#define AFP_VOL_FLAT 1
41
#define AFP_VOL_FIXED 2
42
#define AFP_VOL_VARIABLE 3
43
44
/* The root directory ID, p.26 */
45
46
#define AFP_ROOT_DID 2
47
48
/* Path type constants, p.249 */
49
50
enum {
51
kFPShortName = 1,
52
kFPLongName = 2,
53
kFPUTF8Name = 3
54
};
55
56
/* fork types */
57
58
#define AFP_FORKTYPE_DATA 0x0
59
#define AFP_FORKTYPE_RESOURCE 0x80
60
61
/* openfork access modes, from p.196 */
62
63
#define AFP_OPENFORK_ALLOWREAD 1
64
#define AFP_OPENFORK_ALLOWWRITE 2
65
#define AFP_OPENFORK_DENYREAD 0x10
66
#define AFP_OPENFORK_DENYWRITE 0x20
67
68
/* Message type for getsrvmesg, p. 169*/
69
70
typedef enum {
71
  AFPMESG_LOGIN = 0,
72
  AFPMESG_SERVER = 1
73
} afpmessage_t;
74
75
/* Message bitmap for getsrvrmsg */
76
77
#define AFP_GETSRVRMSG_UTF8 0x2
78
#define AFP_GETSRVRMSG_GETMSG 0x1
79
80
81
/* Maximum Version length, p.17 */
82
#define AFP_MAX_VERSION_LENGTH 16
83
84
/* Maximum length of a token, this is undocumented */
85
#define AFP_TOKEN_MAX_LEN 256
86
87
/* The maximum size of a file for AFP 2 */
88
#define AFP_MAX_AFP2_FILESIZE (4294967296)
89
90
/* Unix privs, p.240 */
91
92
struct afp_unixprivs {
93
	uint32_t uid __attribute__((__packed__));
94
	uint32_t gid __attribute__((__packed__));
95
	uint32_t permissions __attribute__((__packed__));
96
	uint32_t ua_permissions __attribute__((__packed__));
97
98
};
99
100
101
/* AFP Volume attributes bitmap, p.241 */
102
103
enum {
104
    kReadOnly = 0x01,
105
    kHasVolumePassword = 0x02,
106
    kSupportsFileIDs = 0x04,
107
    kSupportsCatSearch = 0x08,
108
    kSupportsBlankAccessPrivs = 0x10,
109
    kSupportsUnixPrivs = 0x20,
110
    kSupportsUTF8Names = 0x40,
111
    kNoNetworkUserIDs = 0x80,
112
    kDefaultPrivsFromParent = 0x100,
113
    kNoExchangeFiles = 0x200,
114
    kSupportsExtAttrs = 0x400,
115
    kSupportsACLs=0x800
116
};
117
118
/* AFP file creation constantes, p.250 */
119
enum {
120
kFPSoftCreate = 0,
121
kFPHardCreate = 0x80
122
};
123
124
/* AFP Directory attributes, taken from the protocol guide p.236 */
125
126
enum {
127
    kFPAttributeBit = 0x1,
128
    kFPParentDirIDBit = 0x2,
129
    kFPCreateDateBit = 0x4,
130
    kFPModDateBit = 0x8,
131
    kFPBackupDateBit = 0x10,
132
    kFPFinderInfoBit = 0x20,
133
    kFPLongNameBit = 0x40,
134
    kFPShortNameBit = 0x80,
135
    kFPNodeIDBit = 0x100,
136
    kFPOffspringCountBit = 0x0200,
137
    kFPOwnerIDBit = 0x0400,
138
    kFPGroupIDBit = 0x0800,
139
    kFPAccessRightsBit = 0x1000,
140
    kFPProDOSInfoBit = 0x2000, // AFP version 2.2 and earlier
141
    kFPUTF8NameBit = 0x2000, // AFP version 3.0 and later
142
    kFPUnixPrivsBit = 0x8000 // AFP version 3.0 and later
143
};
144
145
/* AFP File bitmap, p.238.  These are the ones not in the AFP Directory
146
   attributes map. */
147
148
enum {
149
	kFPDataForkLenBit = 0x0200,
150
	kFPRsrcForkLenBit = 0x0400,
151
	kFPExtDataForkLenBit = 0x0800, // AFP version 3.0 and later
152
	kFPLaunchLimitBit = 0x1000,
153
	kFPExtRsrcForkLenBit = 0x4000, // AFP version 3.0 and later
154
};
155
156
/* AFP Extended Attributes Bitmap, p.238  */
157
158
enum {
159
	kXAttrNoFollow = 0x1,
160
	kXAttrCreate = 0x2,
161
	kXAttrREplace=0x4
162
};
163
164
165
/* AFP function codes */
166
enum AFPFunction
167
{
168
        afpByteRangeLock = 1, afpCloseVol, afpCloseDir, afpCloseFork,
169
        afpCopyFile, afpCreateDir, afpCreateFile,
170
        afpDelete, afpEnumerate, afpFlush, afpFlushFork,
171
        afpGetForkParms = 14, afpGetSrvrInfo, afpGetSrvrParms,
172
        afpGetVolParms, afpLogin, afpLoginCont, afpLogout, afpMapID,
173
        afpMapName, afpMoveAndRename, afpOpenVol, afpOpenDir, afpOpenFork,
174
        afpRead, afpRename, afpSetDirParms, afpSetFileParms,
175
        afpSetForkParms, afpSetVolParms, afpWrite, afpGetFileDirParms,
176
	afpSetFileDirParms, afpChangePassword,
177
        afpGetUserInfo=37,afpGetSrvrMsg = 38,
178
	afpOpenDT=48,
179
	afpCloseDT=49,
180
	afpGetIcon=51, afpGetIconInfo=52,
181
	afpAddComment=56, afpRemoveComment=57, afpGetComment=58,
182
	afpByteRangeLockExt=59, afpReadExt, afpWriteExt,
183
	afpGetAuthMethods=62,
184
	afp_LoginExt=63,
185
	afpGetSessionToken=64,
186
	afpDisconnectOldSession=65,
187
	afpEnumerateExt=66,
188
	afpCatSearchExt = 67,
189
	afpEnumerateExt2 = 68, afpGetExtAttr, afpSetExtAttr, 
190
	afpRemoveExtAttr , afpListExtAttrs,
191
	afpZzzzz = 122,
192
	afpAddIcon=192,
193
};
194
195
/* AFP Volume bitmap.  Take from 242 of the protocol guide. */
196
enum {
197
	kFPBadVolPre222Bitmap = 0xFe00,
198
	kFPBadVolBitmap = 0xF000,
199
	kFPVolAttributeBit = 0x1,
200
	kFPVolSignatureBit = 0x2,
201
	kFPVolCreateDateBit = 0x4,
202
	kFPVolModDateBit = 0x8,
203
	kFPVolBackupDateBit = 0x10,
204
	kFPVolIDBit = 0x20,
205
	kFPVolBytesFreeBit = 0x40,
206
	kFPVolBytesTotalBit = 0x80,
207
	kFPVolNameBit = 0x100,
208
	kFPVolExtBytesFreeBit = 0x200,
209
	kFPVolExtBytesTotalBit = 0x400,
210
	kFPVolBlockSizeBit = 0x800
211
};
212
213
/* AFP Attention Codes -- 4 bits */
214
#define AFPATTN_SHUTDOWN     (1 << 15)            /* shutdown/disconnect */
215
#define AFPATTN_CRASH        (1 << 14)            /* server crashed */
216
#define AFPATTN_MESG         (1 << 13)            /* server has message */
217
#define AFPATTN_NORECONNECT  (1 << 12)            /* don't reconnect */
218
/* server notification */
219
#define AFPATTN_NOTIFY       (AFPATTN_MESG | AFPATTN_NORECONNECT) 
220
221
/* extended bitmap -- 12 bits. volchanged is only useful w/ a server
222
 * notification, and time is only useful for shutdown. */
223
#define AFPATTN_VOLCHANGED   (1 << 0)             /* volume has changed */
224
#define AFPATTN_TIME(x)      ((x) & 0xfff)        /* time in minutes */
225
226
#define kFPNoErr 0
227
228
/* AFP result codes, p252 */
229
#define kASPSessClosed -1072
230
#define kFPAccessDenied -5000
231
#define kFPAuthContinue -5001
232
#define kFPBadUAM -5002
233
#define kFPBadVersNum -5003
234
#define kFPBitmapErr -5004
235
#define kFPCantMove -5005
236
#define kFPDenyConflict -5006
237
#define kFPDirNotEmpty -5007
238
#define kFPDiskFull -5008
239
#define kFPEOFErr -5009
240
#define kFPFileBusy -5010
241
#define kFPFlatVol -5011
242
#define kFPItemNotFound -5012
243
#define kFPLockErr -5013
244
#define kFPMiscErr -5014
245
#define kFPNoMoreLocks -5015
246
#define kFPNoServer -5016
247
#define kFPObjectExists -5017
248
#define kFPObjectNotFound -5018
249
#define kFPParamErr -5019
250
#define kFPRangeNotLocked -5020
251
#define kFPRangeOverlap -5021
252
#define kFPSessClosed -5022
253
#define kFPUserNotAuth -5023
254
#define kFPCallNotSupported -5024
255
#define kFPObjectTypeErr -5025
256
#define kFPTooManyFilesOpen -5026
257
#define kFPServerGoingDown -5027
258
#define kFPCantRename -5028
259
#define kFPDirNotFound -5029
260
#define kFPIconTypeError -5030
261
#define kFPVolLocked -5031
262
#define kFPObjectLocked -5032
263
#define kFPContainsSharedErr -5033
264
#define kFPIDNotFound -5034
265
#define kFPIDExists -5035
266
#define kFPDiffVolErr  -5036
267
#define kFPCatalogChanged -5037
268
#define kFPSameObjectErr -5038
269
#define kFPBadIDErr -5039
270
#define kFPPwdSameErr -5040
271
#define kFPPwdTooShortErr -5041
272
#define kFPPwdExpiredErr -5042
273
#define kFPInsideSharedErr -5043
274
#define kFPInsideTrashErr -5044
275
#define kFPPwdNeedsChangeErr -5045
276
#define kFPPwdPolicyErr -5046
277
#define kFPDiskQuotaExceeded –5047 
278
279
280
281
/* These flags determine to lock or unlock in ByteRangeLock(Ext) */
282
283
enum {
284
ByteRangeLock_Lock = 0,
285
ByteRangeLock_Unlock = 1
286
};
287
288
/* These flags are used in volopen and getsrvrparm replies, p.171 */
289
290
#define HasConfigInfo 0x1
291
#define HasPassword 0x80
292
293
/* These are the subfunction for kFPMapID, as per p.248 */
294
295
enum {
296
kUserIDToName = 1,
297
kGroupIDToName = 2,
298
kUserIDToUTF8Name = 3,
299
kGroupIDToUTF8Name = 4,
300
kUserUUIDToUTF8Name = 5,
301
kGroupUUIDToUTF8Name = 6
302
};
303
304
305
/* These are the subfunction flags described in the FPMapName command, p.286.
306
   Note that this is different than what's described on p. 186. */
307
308
enum {
309
kNameToUserID = 1,
310
kNameToGroupID = 2,
311
kUTF8NameToUserID = 3,
312
kUTF8NameToGroupID = 4,
313
kUTF8NameToUserUUID = 5,
314
kUTF8NameToGroupUUID = 6
315
};
316
317
/* These are bits for FPGetUserInfo, p.173. */
318
#define kFPGetUserInfo_USER_ID 1
319
#define kFPGetUserInfo_PRI_GROUPID 2
320
321
/* Flags for the replies of GetSrvrInfo and DSI GetStatus, p.240 */
322
323
enum {
324
	kSupportsCopyfile = 0x01,
325
	kSupportsChgPwd = 0x02,
326
	kDontAllowSavePwd = 0x04,
327
	kSupportsSrvrMsg = 0x08,
328
	kSrvrSig = 0x10,
329
	kSupportsTCP = 0x20,
330
	kSupportsSrvrNotify = 0x40,
331
	kSupportsReconnect = 0x80,
332
	kSupportsDirServices = 0x100,
333
	kSupportsUTF8SrvrName = 0x200,
334
	kSupportsUUIDs = 0x400,
335
	kSupportsSuperClient = 0x8000
336
};
337
338
339
/* p.247 */
340
341
enum {
342
	kLoginWithoutID = 0,
343
	kLoginWithID = 1,
344
	kReconnWithID = 2,
345
	kLoginWithTimeAndID = 3,
346
	kReconnWithTimeAndID = 4,
347
	kRecon1Login = 5,
348
	kRecon1ReconnectLogin = 6,
349
	kRecon1Refresh = 7, kGetKerberosSessionKey = 8
350
};
351
352
353
#define AFP_CHMOD_ALLOWED_BITS_22 \
354
	(S_IRUSR |S_IWUSR | S_IRGRP | S_IWGRP |S_IROTH | S_IWOTH | S_IFREG )
355
356
357
#endif
358
359
360
361
(-)afpfs-ng-0.8.1/include/codepage.h (-11 lines)
Lines 1-11 Link Here
1
#ifndef __CODE_PAGE_H_
2
#define __CODE_PAGE_H_
3
int convert_utf8dec_to_utf8pre(const char *src, int src_len,
4
	char * dest, int dest_len);
5
int convert_utf8pre_to_utf8dec(const char * src, int src_len, 
6
	char * dest, int dest_len);
7
int convert_path_to_unix(char encoding, char * dest, 
8
	char * src, int dest_len);
9
int convert_path_to_afp(char encoding, char * dest, 
10
	char * src, int dest_len);
11
#endif
(-)afpfs-ng-0.8.1/include/dsi.h (-33 lines)
Lines 1-33 Link Here
1
2
#ifndef __DSI_H_
3
#define __DSI_H_
4
5
#include "afp.h"
6
7
struct dsi_request
8
{
9
	unsigned short requestid;
10
	unsigned char subcommand;
11
	void * other;
12
	unsigned char wait;
13
	pthread_cond_t  condition_cond;
14
	struct dsi_request * next;
15
	int return_code;
16
};
17
18
int dsi_receive(struct afp_server * server, void * data, int size);
19
int dsi_getstatus(struct afp_server * server);
20
21
int dsi_opensession(struct afp_server *server);
22
23
int dsi_send(struct afp_server *server, char * msg, int size,int wait,unsigned char subcommand, void ** other);
24
struct dsi_session * dsi_create(struct afp_server *server);
25
int dsi_restart(struct afp_server *server);
26
int dsi_recv(struct afp_server * server);
27
28
#define DSI_BLOCK_TIMEOUT -1
29
#define DSI_DONT_WAIT 0
30
#define DSI_DEFAULT_TIMEOUT 5
31
32
33
#endif
(-)afpfs-ng-0.8.1/include/libafpclient.h (-50 lines)
Lines 1-50 Link Here
1
2
#ifndef __CLIENT_H_
3
#define __CLIENT_H_
4
5
#include <unistd.h>
6
#include <syslog.h>
7
8
#define MAX_CLIENT_RESPONSE 2048
9
10
11
enum loglevels {
12
        AFPFSD,
13
};
14
15
struct afp_server;
16
struct afp_volume;
17
18
struct libafpclient {
19
        int (*unmount_volume) (struct afp_volume * volume);
20
	void (*log_for_client)(void * priv,
21
        	enum loglevels loglevel, int logtype, const char *message);
22
	void (*forced_ending_hook)(void);
23
	int (*scan_extra_fds)(int command_fd,fd_set *set, int * max_fd);
24
	void (*loop_started)(void);
25
} ;
26
27
extern struct libafpclient * libafpclient;
28
29
void libafpclient_register(struct libafpclient * tmpclient);
30
31
32
void signal_main_thread(void);
33
34
/* These are logging functions */
35
36
#define MAXLOGSIZE 2048
37
38
#define LOG_METHOD_SYSLOG 1
39
#define LOG_METHOD_STDOUT 2
40
41
void set_log_method(int m);
42
43
44
void log_for_client(void * priv,
45
        enum loglevels loglevel, int logtype, char * message,...);
46
47
void stdout_log_for_client(void * priv,
48
	enum loglevels loglevel, int logtype, const char *message);
49
50
#endif
(-)afpfs-ng-0.8.1/include/Makefile.am (+3 lines)
Line 0 Link Here
1
## Process this file with automake to produce Makefile.in
2
3
SUBDIRS = afpfs-ng
(-)afpfs-ng-0.8.1/include/map_def.h (-15 lines)
Lines 1-15 Link Here
1
#ifndef __MAP_H_
2
#define __MAP_H_
3
4
#include "afp.h"
5
6
#define AFP_MAPPING_UNKNOWN 0
7
#define AFP_MAPPING_COMMON 1
8
#define AFP_MAPPING_LOGINIDS 2
9
#define AFP_MAPPING_NAME 3
10
11
unsigned int map_string_to_num(char * name);
12
char * get_mapping_name(struct afp_volume * volume);
13
14
15
#endif
(-)afpfs-ng-0.8.1/include/midlevel.h (-64 lines)
Lines 1-64 Link Here
1
#ifndef __MIDLEVEL_H_
2
#define __MIDLEVEL_H_ 
3
4
#include <utime.h>
5
#include "afp.h"
6
7
int ml_open(struct afp_volume * volume, const char *path, int flags, 
8
        struct afp_file_info **newfp);
9
10
int ml_creat(struct afp_volume * volume, const char *path,mode_t mode);
11
12
int ml_readdir(struct afp_volume * volume, 
13
	const char *path, 
14
	struct afp_file_info **base);
15
16
int ml_read(struct afp_volume * volume, const char *path,
17
	char *buf, size_t size, off_t offset,
18
	struct afp_file_info *fp, int * eof);
19
20
int ml_chmod(struct afp_volume * vol, const char * path, mode_t mode);
21
22
int ml_unlink(struct afp_volume * vol, const char *path);
23
24
int ml_mkdir(struct afp_volume * vol, const char * path, mode_t mode);
25
26
int ml_close(struct afp_volume * volume, const char * path,
27
        struct afp_file_info * fp);
28
29
int ml_getattr(struct afp_volume * volume, const char *path, 
30
	struct stat *stbuf);
31
32
int ml_write(struct afp_volume * volume, const char * path, 
33
	const char *data, size_t size, off_t offset,
34
	struct afp_file_info * fp, uid_t uid,
35
	gid_t gid);
36
37
int ml_readlink(struct afp_volume * vol, const char * path,
38
        char *buf, size_t size);
39
40
int ml_rmdir(struct afp_volume * vol, const char *path);
41
42
int ml_chown(struct afp_volume * vol, const char * path,   
43
        uid_t uid, gid_t gid);
44
45
int ml_truncate(struct afp_volume * vol, const char * path, off_t offset);
46
47
int ml_utime(struct afp_volume * vol, const char * path,
48
	struct utimbuf * timebuf);
49
50
int ml_symlink(struct afp_volume *vol, const char * path1, const char * path2);
51
52
int ml_rename(struct afp_volume * vol,
53
	const char * path_from, const char * path_to);
54
55
int ml_statfs(struct afp_volume * vol, const char *path, struct statvfs *stat);
56
57
void afp_ml_filebase_free(struct afp_file_info **filebase);
58
59
int ml_passwd(struct afp_server *server,
60
                char * username, char * oldpasswd, char * newpasswd);
61
62
63
64
#endif
(-)afpfs-ng-0.8.1/include/uams_def.h (-16 lines)
Lines 1-16 Link Here
1
#ifndef __UAM_DEFS_H_
2
#define __UAM_DEFS_H_
3
4
#define UAM_NOUSERAUTHENT 0x1
5
#define UAM_CLEARTXTPASSWRD 0x2
6
#define UAM_RANDNUMEXCHANGE 0x4
7
#define UAM_2WAYRANDNUM 0x8
8
#define UAM_DHCAST128 0x10
9
#define UAM_CLIENTKRB 0x20
10
#define UAM_DHX2 0x40
11
#define UAM_RECON1 0x80
12
13
int uam_string_to_bitmap(char * name);
14
char * uam_bitmap_to_string(unsigned int bitmap);
15
16
#endif
(-)afpfs-ng-0.8.1/include/utils.h (-43 lines)
Lines 1-43 Link Here
1
#ifndef __UTILS_H_
2
#define __UTILS_H_
3
#include <stdio.h>
4
5
#include "afp.h"
6
7
#if BYTE_ORDER == BIG_ENDIAN
8
#define hton64(x)       (x)
9
#define ntoh64(x)       (x)
10
#else /* BYTE_ORDER == BIG_ENDIAN */
11
#define hton64(x)       ((u_int64_t) (htonl(((x) >> 32) & 0xffffffffLL)) | \
12
                         (u_int64_t) ((htonl(x) & 0xffffffffLL) << 32))
13
#define ntoh64(x)       (hton64(x))
14
#endif /* BYTE_ORDER == BIG_ENDIAN */
15
16
#define min(a,b) (((a)<(b)) ? (a) : (b))
17
#define max(a,b) (((a)>(b)) ? (a) : (b))
18
19
20
21
unsigned char unixpath_to_afppath(
22
        struct afp_server * server,
23
        char * buf);
24
25
unsigned char sizeof_path_header(struct afp_server * server);
26
27
28
29
unsigned char copy_from_pascal(char *dest, char *pascal,unsigned int max_len) ;
30
unsigned short copy_from_pascal_two(char *dest, char *pascal,unsigned int max_len);
31
32
unsigned char copy_to_pascal(char *dest, const char *src);
33
unsigned short copy_to_pascal_two(char *dest, const char *src);
34
35
void copy_path(struct afp_server * server, char * dest, const char * pathname, unsigned char len);
36
37
38
char * create_path(struct afp_server * server, char * pathname, unsigned short * len);
39
40
41
int invalid_filename(struct afp_server * server, const char * filename);
42
43
#endif
(-)afpfs-ng-0.8.1/lib/afp.c (-6 / +6 lines)
Lines 9-15 Link Here
9
9
10
10
11
11
12
#include "afp.h"
12
#include "afpfs-ng/afp.h"
13
#include <config.h>
13
#include <config.h>
14
14
15
#include <stdio.h>
15
#include <stdio.h>
Lines 21-37 Link Here
21
#include <sys/socket.h>
21
#include <sys/socket.h>
22
#include <errno.h>
22
#include <errno.h>
23
23
24
#include "afp_protocol.h"
24
#include "afpfs-ng/afp_protocol.h"
25
#include "libafpclient.h"
25
#include "afpfs-ng/libafpclient.h"
26
#include "server.h"
26
#include "server.h"
27
#include "dsi.h"
27
#include "afpfs-ng/dsi.h"
28
#include "dsi_protocol.h"
28
#include "dsi_protocol.h"
29
#include "utils.h"
29
#include "afpfs-ng/utils.h"
30
#include "afp_replies.h"
30
#include "afp_replies.h"
31
#include "afp_internal.h"
31
#include "afp_internal.h"
32
#include "did.h"
32
#include "did.h"
33
#include "forklist.h"
33
#include "forklist.h"
34
#include "codepage.h"
34
#include "afpfs-ng/codepage.h"
35
35
36
struct afp_versions      afp_versions[] = {
36
struct afp_versions      afp_versions[] = {
37
            { "AFPVersion 1.1", 11 },
37
            { "AFPVersion 1.1", 11 },
(-)afpfs-ng-0.8.1/lib/afp_internal.h (-1 / +1 lines)
Lines 1-7 Link Here
1
#ifndef _AFP_INTERNAL_H_
1
#ifndef _AFP_INTERNAL_H_
2
#define _AFP_INTERNAL_H_
2
#define _AFP_INTERNAL_H_
3
3
4
#include "afp.h"
4
#include "afpfs-ng/afp.h"
5
5
6
extern struct afp_versions afp_versions[];
6
extern struct afp_versions afp_versions[];
7
7
(-)afpfs-ng-0.8.1/lib/afp_url.c (-1 / +1 lines)
Lines 3-9 Link Here
3
#include <stdio.h>
3
#include <stdio.h>
4
#include <stdlib.h>
4
#include <stdlib.h>
5
#include <errno.h>
5
#include <errno.h>
6
#include "afp.h"
6
#include "afpfs-ng/afp.h"
7
7
8
void afp_default_url(struct afp_url *url)
8
void afp_default_url(struct afp_url *url)
9
{
9
{
(-)afpfs-ng-0.8.1/lib/client.c (-2 / +2 lines)
Lines 1-5 Link Here
1
#include <afp.h>
1
#include <afpfs-ng/afp.h>
2
#include <libafpclient.h>
2
#include <afpfs-ng/libafpclient.h>
3
3
4
4
5
struct libafpclient * libafpclient = NULL;
5
struct libafpclient * libafpclient = NULL;
(-)afpfs-ng-0.8.1/lib/codepage.c (-2 / +2 lines)
Lines 14-21 Link Here
14
14
15
#include <string.h>
15
#include <string.h>
16
#include <stdlib.h>
16
#include <stdlib.h>
17
#include "afp_protocol.h"
17
#include "afpfs-ng/afp_protocol.h"
18
#include "utils.h"
18
#include "afpfs-ng/utils.h"
19
#include "unicode.h"
19
#include "unicode.h"
20
20
21
int convert_utf8dec_to_utf8pre(const char *src, int src_len,
21
int convert_utf8dec_to_utf8pre(const char *src, int src_len,
(-)afpfs-ng-0.8.1/lib/connect.c (-6 / +6 lines)
Lines 10-22 Link Here
10
#include <string.h>
10
#include <string.h>
11
#include <sys/socket.h>
11
#include <sys/socket.h>
12
12
13
#include "afp.h"
13
#include "afpfs-ng/afp.h"
14
#include "dsi.h"
14
#include "afpfs-ng/dsi.h"
15
#include "utils.h"
15
#include "afpfs-ng/utils.h"
16
#include "uams_def.h"
16
#include "afpfs-ng/uams_def.h"
17
#include "codepage.h"
17
#include "afpfs-ng/codepage.h"
18
#include "users.h"
18
#include "users.h"
19
#include "libafpclient.h"
19
#include "afpfs-ng/libafpclient.h"
20
#include "server.h"
20
#include "server.h"
21
21
22
22
(-)afpfs-ng-0.8.1/lib/did.c (-2 / +2 lines)
Lines 9-16 Link Here
9
#include <string.h>
9
#include <string.h>
10
#include <stdio.h>
10
#include <stdio.h>
11
11
12
#include "afp.h"
12
#include "afpfs-ng/afp.h"
13
#include "afp_protocol.h"
13
#include "afpfs-ng/afp_protocol.h"
14
14
15
#undef DID_CACHE_DISABLE
15
#undef DID_CACHE_DISABLE
16
16
(-)afpfs-ng-0.8.1/lib/dsi.c (-5 / +5 lines)
Lines 19-30 Link Here
19
#include <signal.h>
19
#include <signal.h>
20
#include <iconv.h>
20
#include <iconv.h>
21
21
22
#include "utils.h"
22
#include "afpfs-ng/utils.h"
23
#include "dsi.h"
23
#include "afpfs-ng/dsi.h"
24
#include "afp.h"
24
#include "afpfs-ng/afp.h"
25
#include "uams_def.h"
25
#include "afpfs-ng/uams_def.h"
26
#include "dsi_protocol.h"
26
#include "dsi_protocol.h"
27
#include "libafpclient.h"
27
#include "afpfs-ng/libafpclient.h"
28
#include "afp_internal.h"
28
#include "afp_internal.h"
29
#include "afp_replies.h"
29
#include "afp_replies.h"
30
30
(-)afpfs-ng-0.8.1/lib/forklist.c (-1 / +1 lines)
Lines 10-16 Link Here
10
*/
10
*/
11
11
12
12
13
#include "afp.h"
13
#include "afpfs-ng/afp.h"
14
14
15
#include <stdlib.h>
15
#include <stdlib.h>
16
#include <pthread.h>
16
#include <pthread.h>
(-)afpfs-ng-0.8.1/lib/log.c (-1 / +1 lines)
Lines 3-9 Link Here
3
#include <stdarg.h>
3
#include <stdarg.h>
4
#include <string.h>
4
#include <string.h>
5
#include <stdlib.h>
5
#include <stdlib.h>
6
#include "libafpclient.h"
6
#include "afpfs-ng/libafpclient.h"
7
7
8
void log_for_client(void * priv,
8
void log_for_client(void * priv,
9
	enum loglevels loglevel, int logtype, char *format, ...) {
9
	enum loglevels loglevel, int logtype, char *format, ...) {
(-)afpfs-ng-0.8.1/lib/loop.c (-3 / +3 lines)
Lines 16-24 Link Here
16
#include <sys/time.h>
16
#include <sys/time.h>
17
#include <signal.h>
17
#include <signal.h>
18
18
19
#include "afp.h"
19
#include "afpfs-ng/afp.h"
20
#include "dsi.h"
20
#include "afpfs-ng/dsi.h"
21
#include "utils.h"
21
#include "afpfs-ng/utils.h"
22
22
23
#define SIGNAL_TO_USE SIGUSR2
23
#define SIGNAL_TO_USE SIGUSR2
24
24
(-)afpfs-ng-0.8.1/lib/lowlevel.c (-4 / +4 lines)
Lines 19-28 Link Here
19
#else
19
#else
20
#include <fcntl.h>
20
#include <fcntl.h>
21
#endif
21
#endif
22
#include "afp.h"
22
#include "afpfs-ng/afp.h"
23
#include "afp_protocol.h"
23
#include "afpfs-ng/afp_protocol.h"
24
#include "codepage.h"
24
#include "afpfs-ng/codepage.h"
25
#include "utils.h"
25
#include "afpfs-ng/utils.h"
26
#include "did.h"
26
#include "did.h"
27
#include "users.h"
27
#include "users.h"
28
28
(-)afpfs-ng-0.8.1/lib/map_def.c (-2 / +2 lines)
Lines 1-6 Link Here
1
#include <string.h>
1
#include <string.h>
2
#include "afp.h"
2
#include "afpfs-ng/afp.h"
3
#include "map_def.h"
3
#include "afpfs-ng/map_def.h"
4
4
5
static char *afp_map_strings[] = {
5
static char *afp_map_strings[] = {
6
	"Unknown",
6
	"Unknown",
(-)afpfs-ng-0.8.1/lib/meta.c (-4 / +4 lines)
Lines 17-26 Link Here
17
#include <unistd.h>
17
#include <unistd.h>
18
#include <sys/time.h>
18
#include <sys/time.h>
19
19
20
#include "afp.h"
20
#include "afpfs-ng/afp.h"
21
#include "dsi.h"
21
#include "afpfs-ng/dsi.h"
22
#include "afp_protocol.h"
22
#include "afpfs-ng/afp_protocol.h"
23
#include "utils.h"
23
#include "afpfs-ng/utils.h"
24
24
25
25
26
int afp_meta_getattr(const char *path, struct stat *stbuf)
26
int afp_meta_getattr(const char *path, struct stat *stbuf)
(-)afpfs-ng-0.8.1/lib/midlevel.c (-4 / +4 lines)
Lines 10-16 Link Here
10
*/
10
*/
11
11
12
12
13
#include "afp.h"
13
#include "afpfs-ng/afp.h"
14
14
15
#include <sys/stat.h>
15
#include <sys/stat.h>
16
#include <string.h>
16
#include <string.h>
Lines 28-36 Link Here
28
#include "users.h"
28
#include "users.h"
29
#include "did.h"
29
#include "did.h"
30
#include "resource.h"
30
#include "resource.h"
31
#include "utils.h"
31
#include "afpfs-ng/utils.h"
32
#include "codepage.h"
32
#include "afpfs-ng/codepage.h"
33
#include "midlevel.h"
33
#include "afpfs-ng/midlevel.h"
34
#include "afp_internal.h"
34
#include "afp_internal.h"
35
#include "forklist.h"
35
#include "forklist.h"
36
#include "uams.h"
36
#include "uams.h"
(-)afpfs-ng-0.8.1/lib/proto_attr.c (-4 / +4 lines)
Lines 7-16 Link Here
7
7
8
#include <string.h>
8
#include <string.h>
9
#include <stdlib.h>
9
#include <stdlib.h>
10
#include "dsi.h"
10
#include "afpfs-ng/dsi.h"
11
#include "afp.h"
11
#include "afpfs-ng/afp.h"
12
#include "utils.h"
12
#include "afpfs-ng/utils.h"
13
#include "afp_protocol.h"
13
#include "afpfs-ng/afp_protocol.h"
14
#include "dsi_protocol.h"
14
#include "dsi_protocol.h"
15
15
16
/* This is a new command, function 76.  There are currently no docs, so this 
16
/* This is a new command, function 76.  There are currently no docs, so this 
(-)afpfs-ng-0.8.1/lib/proto_desktop.c (-4 / +4 lines)
Lines 9-18 Link Here
9
#include <string.h>
9
#include <string.h>
10
#include <stdlib.h>
10
#include <stdlib.h>
11
11
12
#include "dsi.h"
12
#include "afpfs-ng/dsi.h"
13
#include "afp.h"
13
#include "afpfs-ng/afp.h"
14
#include "utils.h"
14
#include "afpfs-ng/utils.h"
15
#include "afp_protocol.h"
15
#include "afpfs-ng/afp_protocol.h"
16
#include "dsi_protocol.h"
16
#include "dsi_protocol.h"
17
17
18
/* closedt, addicon, geticoninfo, addappl, removeappl */
18
/* closedt, addicon, geticoninfo, addappl, removeappl */
(-)afpfs-ng-0.8.1/lib/proto_directory.c (-4 / +4 lines)
Lines 9-18 Link Here
9
#include <string.h>
9
#include <string.h>
10
#include <stdlib.h>
10
#include <stdlib.h>
11
11
12
#include "dsi.h"
12
#include "afpfs-ng/dsi.h"
13
#include "afp.h"
13
#include "afpfs-ng/afp.h"
14
#include "utils.h"
14
#include "afpfs-ng/utils.h"
15
#include "afp_protocol.h"
15
#include "afpfs-ng/afp_protocol.h"
16
#include "dsi_protocol.h"
16
#include "dsi_protocol.h"
17
#include "afp_replies.h"
17
#include "afp_replies.h"
18
18
(-)afpfs-ng-0.8.1/lib/proto_files.c (-4 / +4 lines)
Lines 8-18 Link Here
8
8
9
#include <stdlib.h>
9
#include <stdlib.h>
10
#include <string.h>
10
#include <string.h>
11
#include "dsi.h"
11
#include "afpfs-ng/dsi.h"
12
#include "afp.h"
12
#include "afpfs-ng/afp.h"
13
#include "utils.h"
13
#include "afpfs-ng/utils.h"
14
#include "dsi_protocol.h"
14
#include "dsi_protocol.h"
15
#include "afp_protocol.h"
15
#include "afpfs-ng/afp_protocol.h"
16
#include "afp_internal.h"
16
#include "afp_internal.h"
17
17
18
/* afp_setfileparms, afp_setdirparms and afpsetfiledirparms are all remarkably
18
/* afp_setfileparms, afp_setdirparms and afpsetfiledirparms are all remarkably
(-)afpfs-ng-0.8.1/lib/proto_fork.c (-4 / +4 lines)
Lines 9-19 Link Here
9
#include <stdlib.h>
9
#include <stdlib.h>
10
#include <string.h>
10
#include <string.h>
11
11
12
#include "dsi.h"
12
#include "afpfs-ng/dsi.h"
13
#include "afp.h"
13
#include "afpfs-ng/afp.h"
14
#include "utils.h"
14
#include "afpfs-ng/utils.h"
15
#include "dsi_protocol.h"
15
#include "dsi_protocol.h"
16
#include "afp_protocol.h"
16
#include "afpfs-ng/afp_protocol.h"
17
17
18
int afp_setforkparms(struct afp_volume * volume,
18
int afp_setforkparms(struct afp_volume * volume,
19
	unsigned short forkid, unsigned short bitmap, unsigned long len)
19
	unsigned short forkid, unsigned short bitmap, unsigned long len)
(-)afpfs-ng-0.8.1/lib/proto_login.c (-3 / +3 lines)
Lines 10-19 Link Here
10
10
11
#include <stdlib.h>
11
#include <stdlib.h>
12
#include <string.h>
12
#include <string.h>
13
#include "dsi.h"
13
#include "afpfs-ng/dsi.h"
14
#include "dsi_protocol.h"
14
#include "dsi_protocol.h"
15
#include "afp.h"
15
#include "afpfs-ng/afp.h"
16
#include "utils.h"
16
#include "afpfs-ng/utils.h"
17
#include "afp_internal.h"
17
#include "afp_internal.h"
18
18
19
19
(-)afpfs-ng-0.8.1/lib/proto_map.c (-4 / +4 lines)
Lines 9-19 Link Here
9
#include <stdlib.h>
9
#include <stdlib.h>
10
#include <string.h>
10
#include <string.h>
11
11
12
#include "dsi.h"
12
#include "afpfs-ng/dsi.h"
13
#include "afp.h"
13
#include "afpfs-ng/afp.h"
14
#include "utils.h"
14
#include "afpfs-ng/utils.h"
15
#include "dsi_protocol.h"
15
#include "dsi_protocol.h"
16
#include "afp_protocol.h"
16
#include "afpfs-ng/afp_protocol.h"
17
17
18
/* This is used to pass the return values back from afp_getuserinfo_reply() */
18
/* This is used to pass the return values back from afp_getuserinfo_reply() */
19
struct uidgid {
19
struct uidgid {
(-)afpfs-ng-0.8.1/lib/proto_replyblock.c (-3 / +3 lines)
Lines 6-14 Link Here
6
 */
6
 */
7
7
8
#include <string.h>
8
#include <string.h>
9
#include "dsi.h"
9
#include "afpfs-ng/dsi.h"
10
#include "afp.h"
10
#include "afpfs-ng/afp.h"
11
#include "utils.h"
11
#include "afpfs-ng/utils.h"
12
#include "afp_internal.h"
12
#include "afp_internal.h"
13
13
14
14
(-)afpfs-ng-0.8.1/lib/proto_server.c (-5 / +5 lines)
Lines 7-18 Link Here
7
 */
7
 */
8
#include <stdlib.h>
8
#include <stdlib.h>
9
#include <string.h>
9
#include <string.h>
10
#include "dsi.h"
10
#include "afpfs-ng/dsi.h"
11
#include "afp.h"
11
#include "afpfs-ng/afp.h"
12
#include "utils.h"
12
#include "afpfs-ng/utils.h"
13
#include "dsi_protocol.h"
13
#include "dsi_protocol.h"
14
#include "afp_protocol.h"
14
#include "afpfs-ng/afp_protocol.h"
15
#include "codepage.h"
15
#include "afpfs-ng/codepage.h"
16
#include "afp_internal.h"
16
#include "afp_internal.h"
17
17
18
int afp_getsrvrparms(struct afp_server *server)
18
int afp_getsrvrparms(struct afp_server *server)
(-)afpfs-ng-0.8.1/lib/proto_session.c (-3 / +3 lines)
Lines 8-17 Link Here
8
 */
8
 */
9
#include <stdlib.h>
9
#include <stdlib.h>
10
#include <string.h>
10
#include <string.h>
11
#include "dsi.h"
11
#include "afpfs-ng/dsi.h"
12
#include "dsi_protocol.h"
12
#include "dsi_protocol.h"
13
#include "afp.h"
13
#include "afpfs-ng/afp.h"
14
#include "utils.h"
14
#include "afpfs-ng/utils.h"
15
15
16
int afp_getsessiontoken(struct afp_server * server, int type, 
16
int afp_getsessiontoken(struct afp_server * server, int type, 
17
	unsigned int timestamp, struct afp_token *outgoing_token, 
17
	unsigned int timestamp, struct afp_token *outgoing_token, 
(-)afpfs-ng-0.8.1/lib/proto_volume.c (-5 / +5 lines)
Lines 8-20 Link Here
8
8
9
#include <string.h>
9
#include <string.h>
10
#include <stdlib.h>
10
#include <stdlib.h>
11
#include "dsi.h"
11
#include "afpfs-ng/dsi.h"
12
#include "afp.h"
12
#include "afpfs-ng/afp.h"
13
#include "utils.h"
13
#include "afpfs-ng/utils.h"
14
#include "dsi_protocol.h"
14
#include "dsi_protocol.h"
15
#include "afp_protocol.h"
15
#include "afpfs-ng/afp_protocol.h"
16
#include "afp_internal.h"
16
#include "afp_internal.h"
17
#include "codepage.h"
17
#include "afpfs-ng/codepage.h"
18
18
19
static int parse_volbitmap_reply(struct afp_server * server, 
19
static int parse_volbitmap_reply(struct afp_server * server, 
20
		struct afp_volume * tmpvol, 
20
		struct afp_volume * tmpvol, 
(-)afpfs-ng-0.8.1/lib/resource.c (-2 / +2 lines)
Lines 3-13 Link Here
3
#include <string.h>
3
#include <string.h>
4
#include <errno.h>
4
#include <errno.h>
5
#include <fcntl.h>
5
#include <fcntl.h>
6
#include "afp.h"
6
#include "afpfs-ng/afp.h"
7
#include "resource.h"
7
#include "resource.h"
8
#include "lowlevel.h"
8
#include "lowlevel.h"
9
#include "did.h"
9
#include "did.h"
10
#include "midlevel.h"
10
#include "afpfs-ng/midlevel.h"
11
11
12
#define appledouble ".AppleDouble"
12
#define appledouble ".AppleDouble"
13
#define finderinfo_string ".finderinfo"
13
#define finderinfo_string ".finderinfo"
(-)afpfs-ng-0.8.1/lib/server.c (-7 / +7 lines)
Lines 8-22 Link Here
8
#include <string.h>
8
#include <string.h>
9
#include <time.h>
9
#include <time.h>
10
10
11
#include "afp.h"
11
#include "afpfs-ng/afp.h"
12
#include "dsi.h"
12
#include "afpfs-ng/dsi.h"
13
#include "utils.h"
13
#include "afpfs-ng/utils.h"
14
#include "uams_def.h"
14
#include "afpfs-ng/uams_def.h"
15
#include "codepage.h"
15
#include "afpfs-ng/codepage.h"
16
#include "users.h"
16
#include "users.h"
17
#include "libafpclient.h"
17
#include "afpfs-ng/libafpclient.h"
18
#include "afp_internal.h"
18
#include "afp_internal.h"
19
#include "dsi.h"
19
#include "afpfs-ng/dsi.h"
20
20
21
21
22
struct afp_server * afp_server_complete_connection(
22
struct afp_server * afp_server_complete_connection(
(-)afpfs-ng-0.8.1/lib/status.c (-3 / +3 lines)
Lines 1-8 Link Here
1
#include <string.h>
1
#include <string.h>
2
#include <stdio.h>
2
#include <stdio.h>
3
#include "map_def.h"
3
#include "afpfs-ng/map_def.h"
4
#include "dsi.h"
4
#include "afpfs-ng/dsi.h"
5
#include "afp.h"
5
#include "afpfs-ng/afp.h"
6
6
7
int afp_status_header(char * text, int * len) 
7
int afp_status_header(char * text, int * len) 
8
{
8
{
(-)afpfs-ng-0.8.1/lib/uams.c (-4 / +4 lines)
Lines 8-17 Link Here
8
8
9
#include <string.h>
9
#include <string.h>
10
#include <stdlib.h>
10
#include <stdlib.h>
11
#include "dsi.h"
11
#include "afpfs-ng/dsi.h"
12
#include "afp.h"
12
#include "afpfs-ng/afp.h"
13
#include "utils.h"
13
#include "afpfs-ng/utils.h"
14
#include "uams_def.h"
14
#include "afpfs-ng/uams_def.h"
15
#include "config.h"
15
#include "config.h"
16
16
17
#ifdef HAVE_LIBGCRYPT
17
#ifdef HAVE_LIBGCRYPT
(-)afpfs-ng-0.8.1/lib/users.c (-2 / +2 lines)
Lines 3-10 Link Here
3
#include <grp.h>
3
#include <grp.h>
4
#include <string.h>
4
#include <string.h>
5
5
6
#include "afp.h"
6
#include "afpfs-ng/afp.h"
7
#include "map_def.h"
7
#include "afpfs-ng/map_def.h"
8
8
9
/* How mapping works
9
/* How mapping works
10
 *
10
 *
(-)afpfs-ng-0.8.1/lib/utils.c (-3 / +3 lines)
Lines 8-17 Link Here
8
#include <stdio.h>
8
#include <stdio.h>
9
#include <string.h>
9
#include <string.h>
10
#include <stdlib.h>
10
#include <stdlib.h>
11
#include "afp.h"
11
#include "afpfs-ng/afp.h"
12
#include "utils.h"
12
#include "afpfs-ng/utils.h"
13
#include "afp_internal.h"
13
#include "afp_internal.h"
14
#include "afp_protocol.h"
14
#include "afpfs-ng/afp_protocol.h"
15
15
16
struct afp_path_header_long {
16
struct afp_path_header_long {
17
	unsigned char type;
17
	unsigned char type;
(-)afpfs-ng-0.8.1/Makefile.am (-2 / +2 lines)
Lines 1-5 Link Here
1
if HAVE_LIBFUSE
1
if HAVE_LIBFUSE
2
SUBDIRS = lib fuse cmdline docs
2
SUBDIRS = lib fuse cmdline include docs
3
else
3
else
4
SUBDIRS = lib cmdline docs
4
SUBDIRS = lib cmdline include docs
5
endif
5
endif

Return to bug 182046