There's no point in passing down a 0
authorVolker Lendecke <vl@sernet.de>
Wed, 5 Dec 2007 14:34:07 +0000 (15:34 +0100)
committerVolker Lendecke <vl@sernet.de>
Wed, 5 Dec 2007 14:47:32 +0000 (15:47 +0100)
source/smbd/nttrans.c
source/smbd/open.c

index 8a177c8e762a8dba032e0a0fb89d1ef795409b63..fb85a67d0a0727cf4f1a2a96422a6c84491272b7 100644 (file)
@@ -423,7 +423,6 @@ void reply_ntcreate_and_X(connection_struct *conn, struct smb_request *req)
        SMB_BIG_UINT allocation_size;
        /* Breakout the oplock request bits so we can set the
           reply bits separately. */
-       int oplock_request = 0;
        uint32 fattr=0;
        SMB_OFF_T file_len = 0;
        SMB_STRUCT_STAT sbuf;
@@ -501,7 +500,7 @@ void reply_ntcreate_and_X(connection_struct *conn, struct smb_request *req)
        status = create_file(conn, req, root_dir_fid, fname, flags,
                             access_mask, file_attributes, share_access,
                             create_disposition, create_options,
-                            oplock_request, allocation_size, NULL, NULL,
+                            allocation_size, NULL, NULL,
                             &fsp, &info, &oplock_granted, &sbuf);
 
        if (!NT_STATUS_IS_OK(status)) {
@@ -812,7 +811,6 @@ static void call_nt_transact_create(connection_struct *conn,
        char *params = *ppparams;
        char *data = *ppdata;
        /* Breakout the oplock request bits so we can set the reply bits separately. */
-       int oplock_request = 0;
        uint32 fattr=0;
        SMB_OFF_T file_len = 0;
        SMB_STRUCT_STAT sbuf;
@@ -946,7 +944,7 @@ static void call_nt_transact_create(connection_struct *conn,
        status = create_file(conn, req, root_dir_fid, fname, flags,
                             access_mask, file_attributes, share_access,
                             create_disposition, create_options,
-                            oplock_request, allocation_size, sd, ea_list,
+                            allocation_size, sd, ea_list,
                             &fsp, &info, &oplock_granted, &sbuf);
 
        if(!NT_STATUS_IS_OK(status)) {
index 0a142cd416abbb7ea34925fa7cb045fdc81db049..66ceb8dac75129254b5fc01e70b47c79df301162 100644 (file)
@@ -2454,7 +2454,6 @@ NTSTATUS create_file(connection_struct *conn,
                     uint32_t share_access,
                     uint32_t create_disposition,
                     uint32_t create_options,
-                    int oplock_request,
                     SMB_BIG_UINT allocation_size,
                     struct security_descriptor *sd,
                     struct ea_list *ea_list,
@@ -2470,6 +2469,7 @@ NTSTATUS create_file(connection_struct *conn,
        int info = FILE_WAS_OPENED;
        files_struct *fsp = NULL;
        uint8_t oplock_granted = NO_OPLOCK_RETURN;
+       int oplock_request;
        NTSTATUS status;
 
        DEBUG(10,("create_file: flags = 0x%x, access_mask = 0x%x "
@@ -2619,18 +2619,22 @@ NTSTATUS create_file(connection_struct *conn,
                        ? BATCH_OPLOCK : 0;
        }
 
-       status = resolve_dfspath(
-               talloc_tos(), conn, req->flags2 & FLAGS2_DFS_PATHNAMES,
-               fname, &fname);
+       if (req == NULL) {
+               oplock_request |= INTERNAL_OPEN_ONLY;
+       }
 
-       if (!NT_STATUS_IS_OK(status)) {
-               /*
-                * For PATH_NOT_COVERED we had
-                * reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
-                *                 ERRSRV, ERRbadpath);
-                * Need to fix in callers
-                */
-               goto fail;
+       if ((req != NULL) && (req->flags2 & FLAGS2_DFS_PATHNAMES)) {
+               status = resolve_dfspath(talloc_tos(), conn, true, fname, &fname);
+
+               if (!NT_STATUS_IS_OK(status)) {
+                       /*
+                        * For PATH_NOT_COVERED we had
+                        * reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
+                        *                 ERRSRV, ERRbadpath);
+                        * Need to fix in callers
+                        */
+                       goto fail;
+               }
        }
 
        /*
@@ -2852,9 +2856,15 @@ NTSTATUS create_file(connection_struct *conn,
                   info, (int)oplock_granted));
 
        *result = fsp;
-       *pinfo = info;
-       *poplock_granted = oplock_granted;
-       *psbuf = sbuf;
+       if (pinfo != NULL) {
+               *pinfo = info;
+       }
+       if (poplock_granted != NULL) {
+               *poplock_granted = oplock_granted;
+       }
+       if (psbuf != NULL) {
+               *psbuf = sbuf;
+       }
        TALLOC_FREE(frame);
        return NT_STATUS_OK;