summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2022-11-30 18:45:06 +0100
committerJeremy Allison <jra@samba.org>2022-12-12 21:16:33 +0000
commit8cc0489c8040b1c8836e7a54e0561ed69cb87fec (patch)
tree748e24699f70606470b24db330af2c55e7d88db7 /source3
parent46ce8a47109f3b92ac32d951e414b2e8c80cb5da (diff)
downloadsamba-8cc0489c8040b1c8836e7a54e0561ed69cb87fec.tar.gz
lib: Add get_current_user_info_domain()
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/substitute.c5
-rw-r--r--source3/lib/substitute.h1
-rw-r--r--source3/modules/vfs_virusfilter_utils.c2
-rw-r--r--source3/param/loadparm.c12
-rw-r--r--source3/printing/printing.c6
-rw-r--r--source3/smbd/smb1_message.c2
6 files changed, 17 insertions, 11 deletions
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
index 24486b86f8e..09cf898ddff 100644
--- a/source3/lib/substitute.c
+++ b/source3/lib/substitute.c
@@ -186,6 +186,11 @@ const char *get_current_username(void)
return current_user_info.smb_name;
}
+const char *get_current_user_info_domain(void)
+{
+ return current_user_info.domain;
+}
+
/*******************************************************************
Given a pointer to a %$(NAME) in p and the whole string in str
expand it as an environment variable.
diff --git a/source3/lib/substitute.h b/source3/lib/substitute.h
index ba903434eca..6596ffdbf0c 100644
--- a/source3/lib/substitute.h
+++ b/source3/lib/substitute.h
@@ -32,6 +32,7 @@ void set_current_user_info(const char *smb_name,
const char *unix_name,
const char *domain);
const char *get_current_username(void);
+const char *get_current_user_info_domain(void);
void standard_sub_basic(const char *smb_name,
const char *domain_name,
char *str,
diff --git a/source3/modules/vfs_virusfilter_utils.c b/source3/modules/vfs_virusfilter_utils.c
index a673894e399..4da0503eef0 100644
--- a/source3/modules/vfs_virusfilter_utils.c
+++ b/source3/modules/vfs_virusfilter_utils.c
@@ -1005,7 +1005,7 @@ int virusfilter_shell_set_conn_env(
virusfilter_env_set(mem_ctx, env_list, "VIRUSFILTER_USER_NAME",
get_current_username());
virusfilter_env_set(mem_ctx, env_list, "VIRUSFILTER_USER_DOMAIN",
- current_user_info.domain);
+ get_current_user_info_domain());
return 0;
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 79041908e3d..f5ff1989998 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -1051,14 +1051,14 @@ static char *loadparm_s3_global_substitution_fn(
ret = talloc_sub_basic(mem_ctx,
get_current_username(),
- current_user_info.domain,
+ get_current_user_info_domain(),
s);
if (trim_char(ret, '\"', '\"')) {
if (strchr(ret,'\"') != NULL) {
TALLOC_FREE(ret);
ret = talloc_sub_basic(mem_ctx,
get_current_username(),
- current_user_info.domain,
+ get_current_user_info_domain(),
s);
}
}
@@ -2411,7 +2411,7 @@ bool lp_file_list_changed(void)
n2 = talloc_sub_basic(talloc_tos(),
get_current_username(),
- current_user_info.domain,
+ get_current_user_info_domain(),
f->name);
if (!n2) {
return false;
@@ -2499,7 +2499,7 @@ bool lp_include(struct loadparm_context *lp_ctx, struct loadparm_service *servic
}
fname = talloc_sub_basic(talloc_tos(), get_current_username(),
- current_user_info.domain,
+ get_current_user_info_domain(),
pszParmValue);
add_to_file_list(NULL, &file_lists, pszParmValue, fname);
@@ -4002,7 +4002,7 @@ static bool lp_load_ex(const char *pszFname,
if (lp_config_backend_is_file()) {
n2 = talloc_sub_basic(talloc_tos(), get_current_username(),
- current_user_info.domain,
+ get_current_user_info_domain(),
pszFname);
if (!n2) {
smb_panic("lp_load_ex: out of memory");
@@ -4318,7 +4318,7 @@ int lp_servicenumber(const char *pszServiceName)
*/
fstrcpy(serviceName, ServicePtrs[iService]->szService);
standard_sub_basic(get_current_username(),
- current_user_info.domain,
+ get_current_user_info_domain(),
serviceName,sizeof(serviceName));
if (strequal(serviceName, pszServiceName)) {
break;
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index dbe5a20e382..f7911244398 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -1592,7 +1592,7 @@ static void print_queue_update(struct messaging_context *msg_ctx,
"",
get_current_gid(NULL),
get_current_username(),
- current_user_info.domain,
+ get_current_user_info_domain(),
lpqcommand);
if (!lpqcommand) {
return;
@@ -1612,7 +1612,7 @@ static void print_queue_update(struct messaging_context *msg_ctx,
"",
get_current_gid(NULL),
get_current_username(),
- current_user_info.domain,
+ get_current_user_info_domain(),
lprmcommand);
if (!lprmcommand) {
return;
@@ -2850,7 +2850,7 @@ NTSTATUS print_job_end(struct messaging_context *msg_ctx, int snum,
"",
get_current_gid(NULL),
get_current_username(),
- current_user_info.domain,
+ get_current_user_info_domain(),
lpq_cmd);
if (lpq_cmd == NULL) {
status = NT_STATUS_PRINT_CANCELLED;
diff --git a/source3/smbd/smb1_message.c b/source3/smbd/smb1_message.c
index 6894aa52ec0..7d89cc45158 100644
--- a/source3/smbd/smb1_message.c
+++ b/source3/smbd/smb1_message.c
@@ -123,7 +123,7 @@ static void msg_deliver(struct msg_state *state)
}
s = talloc_sub_basic(talloc_tos(), current_user_info.smb_name,
- current_user_info.domain, s);
+ get_current_user_info_domain(), s);
if (s == NULL) {
goto done;
}