Remove the current_user reference from fake_file.c
authorVolker Lendecke <vl@samba.org>
Sun, 15 Jun 2008 11:37:53 +0000 (13:37 +0200)
committerVolker Lendecke <vl@samba.org>
Sun, 15 Jun 2008 11:37:53 +0000 (13:37 +0200)
The current vuid is not only available there, it is also in the current
smb_request structure.

source/include/proto.h
source/smbd/fake_file.c
source/smbd/open.c

index dfde0c750a2b24df111cedad6b13a4059aaadd69..4bdf808ff7bbfcb6e69208b97b883de73fe1e752 100644 (file)
@@ -9629,6 +9629,7 @@ void reply_unix_error(struct smb_request *req, uint8 defclass, uint32 defcode,
 
 enum FAKE_FILE_TYPE is_fake_file(const char *fname);
 NTSTATUS open_fake_file(connection_struct *conn,
+                               uint16_t current_vuid,
                                enum FAKE_FILE_TYPE fake_file_type,
                                const char *fname,
                                uint32 access_mask,
index 565b557dd3c2d5a9a8972cf33e9e52d4633c1317..47982d4f00c6bdfe9d24372f71aa51afacdb5f57 100644 (file)
@@ -19,8 +19,6 @@
 
 #include "includes.h"
 
-extern struct current_user current_user;
-
 struct fake_file_type {
        const char *name;
        enum FAKE_FILE_TYPE type;
@@ -101,6 +99,7 @@ enum FAKE_FILE_TYPE is_fake_file(const char *fname)
 ****************************************************************************/
 
 NTSTATUS open_fake_file(connection_struct *conn,
+                               uint16_t current_vuid,
                                enum FAKE_FILE_TYPE fake_file_type,
                                const char *fname,
                                uint32 access_mask,
@@ -110,7 +109,7 @@ NTSTATUS open_fake_file(connection_struct *conn,
        NTSTATUS status;
 
        /* access check */
-       if (current_user.ut.uid != 0) {
+       if (conn->server_info->uid != 0) {
                DEBUG(3, ("open_fake_file_shared: access_denied to "
                          "service[%s] file[%s] user[%s]\n",
                          lp_servicename(SNUM(conn)), fname,
@@ -129,7 +128,7 @@ NTSTATUS open_fake_file(connection_struct *conn,
 
        fsp->conn = conn;
        fsp->fh->fd = -1;
-       fsp->vuid = current_user.vuid;
+       fsp->vuid = current_vuid;
        fsp->fh->pos = -1;
        fsp->can_lock = False; /* Should this be true ? - No, JRA */
        fsp->access_mask = access_mask;
index 546128c0e5788562781543081daf73ecce661c6e..9b847ec877c276392144bdbce53718f935caeb30 100644 (file)
@@ -2990,7 +2990,8 @@ NTSTATUS create_file(connection_struct *conn,
                         * also tries a QUERY_FILE_INFO on the file and then
                         * close it
                         */
-                       status = open_fake_file(conn, fake_file_type, fname,
+                       status = open_fake_file(conn, req->vuid,
+                                               fake_file_type, fname,
                                                access_mask, &fsp);
                        if (!NT_STATUS_IS_OK(status)) {
                                goto fail;