]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Remove parent_smb_fname(), no longer used.
authorJeremy Allison <jra@samba.org>
Wed, 26 May 2021 18:51:38 +0000 (11:51 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 2 Jun 2021 06:30:36 +0000 (06:30 +0000)
Moved into the VFS as SMB_VFS_PARENT_PATHNAME() to
allow modules to process the returned parent dirname.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Jun  2 06:30:36 UTC 2021 on sn-devel-184

source3/include/proto.h
source3/lib/filename_util.c

index f9bffb3aa59c9f716871fe842ae1b4bf9cc34b98..d33cccd83903077c5b38c86f3deb2e3ea881003c 100644 (file)
@@ -376,10 +376,6 @@ char *myhostname_upper(void);
 #include "lib/util_path.h"
 bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
                    const char **name);
-bool parent_smb_fname(TALLOC_CTX *mem_ctx,
-                     const struct smb_filename *path,
-                     struct smb_filename **_parent,
-                     struct smb_filename  **_name);
 bool ms_has_wild(const char *s);
 bool ms_has_wild_w(const smb_ucs2_t *s);
 bool mask_match(const char *string, const char *pattern, bool is_case_sensitive);
index 1d4206c33003faff84423aec59ea6146262ce58c..120d2ecc4bcacb9810ff2b37ca5d796f3a866af3 100644 (file)
@@ -269,69 +269,6 @@ struct smb_filename *cp_smb_filename(TALLOC_CTX *mem_ctx,
        return out;
 }
 
-/**
- * Return allocated parent directory and basename of path
- *
- * Note: if requesting name, it is returned as talloc child of the
- * parent. Freeing the parent is thus sufficient to free both.
- */
-bool parent_smb_fname(TALLOC_CTX *mem_ctx,
-                     const struct smb_filename *path,
-                     struct smb_filename **_parent,
-                     struct smb_filename  **_name)
-{
-       TALLOC_CTX *frame = talloc_stackframe();
-       struct smb_filename *parent = NULL;
-       struct smb_filename *name = NULL;
-       char *p = NULL;
-
-       parent = cp_smb_filename(frame, path);
-       if (parent == NULL) {
-               TALLOC_FREE(frame);
-               return false;
-       }
-       TALLOC_FREE(parent->stream_name);
-       SET_STAT_INVALID(parent->st);
-
-       p = strrchr_m(parent->base_name, '/'); /* Find final '/', if any */
-       if (p == NULL) {
-               TALLOC_FREE(parent->base_name);
-               parent->base_name = talloc_strdup(parent, ".");
-               if (parent->base_name == NULL) {
-                       TALLOC_FREE(frame);
-                       return false;
-               }
-               p = path->base_name;
-       } else {
-               *p = '\0';
-               p++;
-       }
-
-       if (_name == NULL) {
-               *_parent = talloc_move(mem_ctx, &parent);
-               TALLOC_FREE(frame);
-               return true;
-       }
-
-       name = cp_smb_filename(frame, path);
-       if (name == NULL) {
-               TALLOC_FREE(frame);
-               return false;
-       }
-       TALLOC_FREE(name->base_name);
-
-       name->base_name = talloc_strdup(name, p);
-       if (name == NULL) {
-               TALLOC_FREE(frame);
-               return false;
-       }
-
-       *_parent = talloc_move(mem_ctx, &parent);
-       *_name = talloc_move(*_parent, &name);
-       TALLOC_FREE(frame);
-       return true;
-}
-
 static void assert_valid_stream_smb_fname(const struct smb_filename *smb_fname)
 {
        /* stream_name must always be NULL if there is no stream. */