Fix bug #8882 - Broken processing of %U with vfs_full_audit when force user is set.
authorJeremy Allison <jra@samba.org>
Mon, 23 Apr 2012 23:19:50 +0000 (16:19 -0700)
committerKarolin Seeger <kseeger@samba.org>
Mon, 28 May 2012 19:36:23 +0000 (21:36 +0200)
When doing a "force user" we need to remember what the "sanitized_username"
was from the original connect.

source3/smbd/service.c

index bc2cdaf2d8574078a9db6cf89d8003d1ffbd7f37..2de9384893568d8cec52c5fcf3da8d82c062debe 100644 (file)
@@ -746,6 +746,14 @@ connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
                        return NULL;
                }
 
+               /* We don't want to replace the original sanitized_username
+                  as it is the original user given in the connect attempt.
+                  This is used in '%U' substitutions. */
+               TALLOC_FREE(forced_serverinfo->sanitized_username);
+               forced_serverinfo->sanitized_username =
+                       talloc_move(forced_serverinfo,
+                                       &conn->server_info->sanitized_username);
+
                TALLOC_FREE(conn->server_info);
                conn->server_info = forced_serverinfo;