]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbclient3: Get all reparse data for allinfo
authorVolker Lendecke <vl@samba.org>
Thu, 6 Jul 2023 15:53:35 +0000 (17:53 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 10 Aug 2023 14:36:40 +0000 (14:36 +0000)
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

source3/client/client.c

index 0948e6a07fd3c4686059ff72c31d337abfb74688..19ff37248c31c5f530c2f640a3abd4e6ab28e53a 100644 (file)
@@ -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;
+
+               rep = talloc_zero(talloc_tos(), struct reparse_data_buffer);
+               if (rep == NULL) {
+                       d_printf("talloc_zero() failed\n");
+                       return false;
+               }
 
-               status = cli_readlink(cli, name, talloc_tos(), &subst, &print,
-                                     &flags);
+               status = cli_get_reparse_data(cli, name, rep, &data, &datalen);
                if (!NT_STATUS_IS_OK(status)) {
-                       d_fprintf(stderr, "cli_readlink returned %s\n",
+                       d_fprintf(stderr,
+                                 "cli_get_reparse_data() failed: %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);
+                       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,