Debian Codegraph @

contrib/mod_sftp/fxp.h

raw symbols SCIP
1 /*
2 * ProFTPD - mod_sftp SFTP
3 * Copyright (c) 2008-2024 TJ Saunders
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18 *
19 * As a special exemption, TJ Saunders and other respective copyright holders
20 * give permission to link this program with OpenSSL, and distribute the
21 * resulting executable, without including the source code for OpenSSL in the
22 * source distribution.
23 */
24
25 #ifndef MOD_SFTP_FXP_H
26 #define MOD_SFTP_FXP_H
27
28 #include "mod_sftp.h"
29
30 #ifdef HAVE_SYS_STATVFS_H
31 # include <sys/statvfs.h>
32 #endif
33
34 /* SFTP Packet Types */
35 #define SFTP_SSH2_FXP_INIT 1
36 #define SFTP_SSH2_FXP_VERSION 2
37 #define SFTP_SSH2_FXP_OPEN 3
38 #define SFTP_SSH2_FXP_CLOSE 4
39 #define SFTP_SSH2_FXP_READ 5
40 #define SFTP_SSH2_FXP_WRITE 6
41 #define SFTP_SSH2_FXP_LSTAT 7
42 #define SFTP_SSH2_FXP_FSTAT 8
43 #define SFTP_SSH2_FXP_SETSTAT 9
44 #define SFTP_SSH2_FXP_FSETSTAT 10
45 #define SFTP_SSH2_FXP_OPENDIR 11
46 #define SFTP_SSH2_FXP_READDIR 12
47 #define SFTP_SSH2_FXP_REMOVE 13
48 #define SFTP_SSH2_FXP_MKDIR 14
49 #define SFTP_SSH2_FXP_RMDIR 15
50 #define SFTP_SSH2_FXP_REALPATH 16
51 #define SFTP_SSH2_FXP_STAT 17
52 #define SFTP_SSH2_FXP_RENAME 18
53 #define SFTP_SSH2_FXP_READLINK 19
54 #define SFTP_SSH2_FXP_SYMLINK 20
55 #define SFTP_SSH2_FXP_LINK 21
56 #define SFTP_SSH2_FXP_LOCK 22
57 #define SFTP_SSH2_FXP_UNLOCK 23
58 #define SFTP_SSH2_FXP_STATUS 101
59 #define SFTP_SSH2_FXP_HANDLE 102
60 #define SFTP_SSH2_FXP_DATA 103
61 #define SFTP_SSH2_FXP_NAME 104
62 #define SFTP_SSH2_FXP_ATTRS 105
63 #define SFTP_SSH2_FXP_EXTENDED 200
64 #define SFTP_SSH2_FXP_EXTENDED_REPLY 201
65
66 /* SFTP Extensions */
67 #define SFTP_FXP_EXT_CHECK_FILE 0x0001
68 #define SFTP_FXP_EXT_COPY_FILE 0x0002
69 #define SFTP_FXP_EXT_VERSION_SELECT 0x0004
70 #define SFTP_FXP_EXT_POSIX_RENAME 0x0008
71 #define SFTP_FXP_EXT_STATVFS 0x0010
72 #define SFTP_FXP_EXT_VENDOR_ID 0x0020
73 #define SFTP_FXP_EXT_SPACE_AVAIL 0x0040
74 #define SFTP_FXP_EXT_FSYNC 0x0080
75 #define SFTP_FXP_EXT_HARDLINK 0x0100
76 #define SFTP_FXP_EXT_XATTR 0x0200
77 #define SFTP_FXP_EXT_HOMEDIR 0x0400
78 #define SFTP_FXP_EXT_USERGROUPNAMES 0x0800
79 #define SFTP_FXP_EXT_LIMITS 0x1000
80
81 #define SFTP_FXP_EXT_DEFAULT \
82 (SFTP_FXP_EXT_CHECK_FILE|SFTP_FXP_EXT_COPY_FILE|SFTP_FXP_EXT_VERSION_SELECT|SFTP_FXP_EXT_POSIX_RENAME|SFTP_FXP_EXT_SPACE_AVAIL|SFTP_FXP_EXT_STATVFS|SFTP_FXP_EXT_FSYNC|SFTP_FXP_EXT_HARDLINK|SFTP_FXP_EXT_HOMEDIR|SFTP_FXP_EXT_LIMITS|SFTP_FXP_EXT_USERGROUPNAMES)
83
84 int sftp_fxp_handle_packet(pool *, void *, uint32_t, unsigned char *, uint32_t);
85
86 int sftp_fxp_open_session(uint32_t);
87 int sftp_fxp_close_session(uint32_t);
88
89 int sftp_fxp_set_displaylogin(const char *);
90 int sftp_fxp_set_extensions(unsigned long);
91
92 int sftp_fxp_set_protocol_version(unsigned int, unsigned int);
93
94 /* Set the SFTP protocol version at which UTF8 decoding/encoding will be done
95 * on the paths/strings sent to/from the SFTP client. The default SFTP
96 * protocol version at which this happens, by IETF Draft, is 4. Some sites
97 * (e.g. Japanese sites) may need the encoding facilities for other SFTP
98 * protocol versions, however.
99 */
100 int sftp_fxp_set_utf8_protocol_version(unsigned int);
101
102 void sftp_fxp_use_gmt(int);
103
104 #endif /* MOD_SFTP_FXP_H */