summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/lanman.c8
-rw-r--r--source3/smbd/msdfs.c11
-rw-r--r--source3/smbd/service.c20
3 files changed, 25 insertions, 14 deletions
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index fce58d069b..31d4a39842 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -103,7 +103,7 @@ static int CopyExpanded(connection_struct *conn,
conn->server_info->unix_name,
conn->connectpath,
conn->server_info->gid,
- get_current_username(),
+ conn->server_info->sanitized_username,
pdb_get_domain(conn->server_info->sam_account),
buf);
if (!buf) {
@@ -154,7 +154,7 @@ static int StrlenExpanded(connection_struct *conn, int snum, char *s)
conn->server_info->unix_name,
conn->connectpath,
conn->server_info->gid,
- get_current_username(),
+ conn->server_info->sanitized_username,
pdb_get_domain(conn->server_info->sam_account),
buf);
if (!buf) {
@@ -184,7 +184,7 @@ static char *Expand(connection_struct *conn, int snum, char *s)
conn->server_info->unix_name,
conn->connectpath,
conn->server_info->gid,
- get_current_username(),
+ conn->server_info->sanitized_username,
pdb_get_domain(conn->server_info->sam_account),
buf);
}
@@ -3010,7 +3010,7 @@ static bool api_RNetServerGetInfo(connection_struct *conn,uint16 vuid,
conn->server_info->unix_name,
conn->connectpath,
conn->server_info->gid,
- get_current_username(),
+ conn->server_info->sanitized_username,
pdb_get_domain(conn->server_info->sam_account),
comment);
if (comment) {
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index e4760ec461..de57d8def2 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -672,6 +672,17 @@ static NTSTATUS dfs_redirect(TALLOC_CTX *ctx,
return NT_STATUS_OK;
}
+ if (!( strequal(pdp->servicename, lp_servicename(SNUM(conn)))
+ || (strequal(pdp->servicename, HOMES_NAME)
+ && strequal(lp_servicename(SNUM(conn)),
+ conn->server_info->sanitized_username) )) ) {
+
+ /* The given sharename doesn't match this connection. */
+ TALLOC_FREE(pdp);
+
+ return NT_STATUS_OBJECT_PATH_NOT_FOUND;
+ }
+
status = dfs_path_lookup(ctx, conn, path_in, pdp,
search_wcard_flag, NULL, NULL);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 4092928de1..fbce22e975 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -840,8 +840,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
conn->server_info->unix_name,
conn->connectpath,
conn->server_info->gid,
- get_current_username(),
- current_user_info.domain,
+ conn->server_info->sanitized_username,
+ pdb_get_domain(conn->server_info->sam_account),
lp_pathname(snum));
if (!s) {
conn_free(conn);
@@ -962,8 +962,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
conn->server_info->unix_name,
conn->connectpath,
conn->server_info->gid,
- get_current_username(),
- current_user_info.domain,
+ conn->server_info->sanitized_username,
+ pdb_get_domain(conn->server_info->sam_account),
lp_rootpreexec(snum));
DEBUG(5,("cmd=%s\n",cmd));
ret = smbrun(cmd,NULL);
@@ -1001,8 +1001,8 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser,
conn->server_info->unix_name,
conn->connectpath,
conn->server_info->gid,
- get_current_username(),
- current_user_info.domain,
+ conn->server_info->sanitized_username,
+ pdb_get_domain(conn->server_info->sam_account),
lp_preexec(snum));
ret = smbrun(cmd,NULL);
TALLOC_FREE(cmd);
@@ -1324,8 +1324,8 @@ void close_cnum(connection_struct *conn, uint16 vuid)
conn->server_info->unix_name,
conn->connectpath,
conn->server_info->gid,
- get_current_username(),
- current_user_info.domain,
+ conn->server_info->sanitized_username,
+ pdb_get_domain(conn->server_info->sam_account),
lp_postexec(SNUM(conn)));
smbrun(cmd,NULL);
TALLOC_FREE(cmd);
@@ -1340,8 +1340,8 @@ void close_cnum(connection_struct *conn, uint16 vuid)
conn->server_info->unix_name,
conn->connectpath,
conn->server_info->gid,
- get_current_username(),
- current_user_info.domain,
+ conn->server_info->sanitized_username,
+ pdb_get_domain(conn->server_info->sam_account),
lp_rootpostexec(SNUM(conn)));
smbrun(cmd,NULL);
TALLOC_FREE(cmd);