From ad04a6ce49fc3811a62a3c736305cc06fb2611b9 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Fri, 16 Mar 2018 19:01:20 +0100 Subject: [PATCH] s3:lib: add root_unix_token() Signed-off-by: Ralph Boehme Reviewed-by: Volker Lendecke Reviewed-by: Stefan Metzmacher --- source3/include/proto.h | 1 + source3/lib/util.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/source3/include/proto.h b/source3/include/proto.h index c92d9921d6e..81065c893bb 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -415,6 +415,7 @@ bool map_open_params_to_ntcreate(const char *smb_base_fname, uint32_t *pcreate_options, uint32_t *pprivate_flags); struct security_unix_token *copy_unix_token(TALLOC_CTX *ctx, const struct security_unix_token *tok); +struct security_unix_token *root_unix_token(TALLOC_CTX *mem_ctx); bool dir_check_ftype(uint32_t mode, uint32_t dirtype); /* The following definitions come from lib/util_builtin.c */ diff --git a/source3/lib/util.c b/source3/lib/util.c index a3fe7c8aea2..8ff330bcd26 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2144,6 +2144,32 @@ struct security_unix_token *copy_unix_token(TALLOC_CTX *ctx, const struct securi } /**************************************************************************** + Return a root token +****************************************************************************/ + +struct security_unix_token *root_unix_token(TALLOC_CTX *mem_ctx) +{ + struct security_unix_token *t = NULL; + + t = talloc_zero(mem_ctx, struct security_unix_token); + if (t == NULL) { + return NULL; + } + + /* + * This is not needed, but lets make it explicit, not implicit. + */ + *t = (struct security_unix_token) { + .uid = 0, + .gid = 0, + .ngroups = 0, + .groups = NULL + }; + + return t; +} + +/**************************************************************************** Check that a file matches a particular file type. ****************************************************************************/ -- 2.11.4.GIT