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

source3/smbd/service.c

index f57e57f6701fa3a5718919cef90a126a5c2fc4e7..6c8c8d3461ba31f1b223ba25b7c664ff9811e553 100644 (file)
@@ -696,6 +696,14 @@ NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum)
                        return status;
                }
 
+               /* 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->session_info->sanitized_username);
+
                TALLOC_FREE(conn->session_info);
                conn->session_info = forced_serverinfo;