mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
smbclient3: Get all reparse data for allinfo
If we hit a reparse point in point, it might be something but a symlink. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Thu Aug 10 14:36:40 UTC 2023 on atb-devel-224
This commit is contained in:
parent
a0edab5092
commit
5ec660160e
@ -41,6 +41,7 @@
|
||||
#include "lib/util/time_basic.h"
|
||||
#include "lib/util/string_wrappers.h"
|
||||
#include "lib/cmdline/cmdline.h"
|
||||
#include "libcli/smb/reparse.h"
|
||||
|
||||
#ifndef REGISTER
|
||||
#define REGISTER 0
|
||||
@ -1707,20 +1708,38 @@ static int do_allinfo(const char *name)
|
||||
}
|
||||
|
||||
if (attr & FILE_ATTRIBUTE_REPARSE_POINT) {
|
||||
char *subst, *print;
|
||||
uint32_t flags;
|
||||
struct reparse_data_buffer *rep = NULL;
|
||||
uint8_t *data = NULL;
|
||||
uint32_t datalen;
|
||||
char *s = NULL;
|
||||
|
||||
status = cli_readlink(cli, name, talloc_tos(), &subst, &print,
|
||||
&flags);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_fprintf(stderr, "cli_readlink returned %s\n",
|
||||
nt_errstr(status));
|
||||
} else {
|
||||
d_printf("symlink: subst=[%s], print=[%s], flags=%x\n",
|
||||
subst, print, flags);
|
||||
TALLOC_FREE(subst);
|
||||
TALLOC_FREE(print);
|
||||
rep = talloc_zero(talloc_tos(), struct reparse_data_buffer);
|
||||
if (rep == NULL) {
|
||||
d_printf("talloc_zero() failed\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
status = cli_get_reparse_data(cli, name, rep, &data, &datalen);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_fprintf(stderr,
|
||||
"cli_get_reparse_data() failed: %s\n",
|
||||
nt_errstr(status));
|
||||
TALLOC_FREE(rep);
|
||||
return false;
|
||||
}
|
||||
|
||||
status = reparse_data_buffer_parse(rep, rep, data, datalen);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_fprintf(stderr,
|
||||
"reparse_data_buffer_parse() failed: %s\n",
|
||||
nt_errstr(status));
|
||||
TALLOC_FREE(rep);
|
||||
return false;
|
||||
}
|
||||
|
||||
s = reparse_data_buffer_str(rep, rep);
|
||||
d_printf("%s", s);
|
||||
TALLOC_FREE(rep);
|
||||
}
|
||||
|
||||
status = cli_ntcreate(cli, name, 0,
|
||||
|
Loading…
Reference in New Issue
Block a user