#include <windows.h>
#include <strsafe.h>
#include "nfs41_ops.h"
#include "upcall.h"
#include "util.h"
#include "daemon_debug.h"
Go to the source code of this file.
|
static int | abs_path_link (OUT nfs41_abs_path *path, IN char *path_pos, IN const char *link, IN uint32_t link_len) |
|
int | nfs41_symlink_target (IN nfs41_session *session, IN nfs41_path_fh *file, OUT nfs41_abs_path *target) |
|
int | nfs41_symlink_follow (IN nfs41_root *root, IN nfs41_session *session, IN nfs41_path_fh *symlink, OUT nfs41_file_info *info) |
|
static int | parse_symlink (unsigned char *buffer, uint32_t length, nfs41_upcall *upcall) |
|
static int | handle_symlink (nfs41_upcall *upcall) |
|
static int | marshall_symlink (unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall) |
|
◆ abs_path_link()
Definition at line 31 of file symlink.c.
36{
39 const char *link_pos =
link;
40 const char *link_end =
link + link_len;
42
43
45 path_pos =
path->path;
46
47
50
52 path_pos++;
53
54
56 continue;
58
60 eprintf(
"symlink with .. that points below server root!\n");
63 }
65 continue;
66 }
67
68
73 }
78 }
79 }
80
81
82 if (path_pos == path_max) {
85 }
86 *path_pos = '\0';
90}
bool_t last_component(IN const char *path, IN const char *path_end, OUT nfs41_component *component)
bool_t next_component(IN const char *path, IN const char *path_end, OUT nfs41_component *component)
__inline int is_delimiter(char c)
__inline const char * prev_delimiter(const char *pos, const char *start)
void eprintf(LPCSTR format,...)
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
#define NFS41_MAX_PATH_LEN
#define ERROR_BAD_NETPATH
#define ERROR_BUFFER_OVERFLOW
Referenced by nfs41_symlink_target().
◆ handle_symlink()
Definition at line 211 of file symlink.c.
212{
216
219
220
222 for (
p =
args->target_set; *
p;
p++)
if (*
p ==
'\\') *
p =
'/';
223
224 if (
state->file.fh.len) {
225
226
227 eprintf(
"handle_symlink: attempting to create a symlink when "
228 "the file=%s was already created on open; sending REMOVE "
229 "first\n",
state->file.path->path);
233 eprintf(
"nfs41_remove() for symlink=%s failed with %s\n",
237 }
238 }
239
240
244 createattrs.
mode = 0777;
248 eprintf(
"nfs41_create() for symlink=%s failed with %s\n",
252 }
253 } else {
255
256
260 eprintf(
"nfs41_readlink() for filename=%s failed with %s\n",
264 }
266 dprintf(2,
"returning symlink target '%s'\n",
args->target_get.path);
267 }
270}
int map_symlink_errors(int status)
const char * nfs_error_string(int status)
nfs41_updowncall_list upcall
int nfs41_create(IN nfs41_session *session, IN uint32_t type, IN nfs41_file_info *createattrs, IN OPTIONAL const char *symlink, IN nfs41_path_fh *parent, OUT nfs41_path_fh *file, OUT nfs41_file_info *info)
int nfs41_remove(IN nfs41_session *session, IN nfs41_path_fh *parent, IN const nfs41_component *target, IN uint64_t fileid)
int nfs41_readlink(IN nfs41_session *session, IN nfs41_path_fh *file, IN uint32_t max_len, OUT char *link_out, OUT uint32_t *len_out)
◆ marshall_symlink()
Definition at line 272 of file symlink.c.
273{
275 unsigned short len = (
args->target_get.len + 1) *
sizeof(
WCHAR);
277
280
283
285 args->target_get.path,
args->target_get.len,
289 }
292}
int safe_write(unsigned char **pos, uint32_t *remaining, void *src, uint32_t src_len)
#define MultiByteToWideChar
GLuint GLsizei GLsizei * length
◆ nfs41_symlink_follow()
Definition at line 146 of file symlink.c.
151{
156
159
160 dprintf(2,
"--> nfs41_symlink_follow('%s')\n", symlink->path->path);
161
162 do {
166 }
167
168
171
173
175
176
180
184 dprintf(2,
"<-- nfs41_symlink_follow() returning %d\n",
status);
186}
int nfs41_lookup(IN nfs41_root *root, IN nfs41_session *session, IN OUT nfs41_abs_path *path_inout, OUT OPTIONAL nfs41_path_fh *parent_out, OUT OPTIONAL nfs41_path_fh *target_out, OUT OPTIONAL nfs41_file_info *info_out, OUT nfs41_session **session_out)
int nfs41_symlink_target(IN nfs41_session *session, IN nfs41_path_fh *file, OUT nfs41_abs_path *target)
VOID WINAPI InitializeSRWLock(PSRWLOCK Lock)
GLint GLint GLsizei GLsizei GLsizei depth
#define NFS41_MAX_SYMLINK_DEPTH
#define ERROR_TOO_MANY_LINKS
Referenced by handle_getattr(), handle_open(), and lookup_symlink().
◆ nfs41_symlink_target()
Definition at line 92 of file symlink.c.
96{
102
103
110 }
111
112 dprintf(2,
"--> nfs41_symlink_target('%s', '%s')\n",
path->path,
link);
113
114
119 }
121
122
124
125
132 }
133 }
136 eprintf(
"abs_path_link() for path %s with link %s failed with %d\n",
139 }
141 dprintf(2,
"<-- nfs41_symlink_target('%s') returning %d\n",
144}
ACPI_SIZE strlen(const char *String)
static int abs_path_link(OUT nfs41_abs_path *path, IN char *path_pos, IN const char *link, IN uint32_t link_len)
__kernel_ptrdiff_t ptrdiff_t
STRSAFEAPI StringCchCatA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
#define ERROR_PATH_NOT_FOUND
Referenced by handle_open(), and nfs41_symlink_follow().
◆ parse_symlink()
Definition at line 190 of file symlink.c.
191{
194
199
202 else
204
205 dprintf(1,
"parsing NFS41_SYMLINK: path='%s' set=%u target='%s'\n",
209}
int safe_read(unsigned char **pos, uint32_t *remaining, void *dest, uint32_t dest_len)
int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name)
◆ nfs41_op_symlink
Initial value:= {
}
static int parse_symlink(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
static int handle_symlink(nfs41_upcall *upcall)
static int marshall_symlink(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
Definition at line 295 of file symlink.c.