Added NTrename SMB (0xA5) - how did we miss this.... ?
authorJeremy Allison <jra@samba.org>
Tue, 24 Feb 2004 00:05:49 +0000 (00:05 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 24 Feb 2004 00:05:49 +0000 (00:05 +0000)
Jeremy.
(This used to be commit d236372876918be2a886a89383cf843b82d4c8db)

source3/include/smb.h
source3/include/smbprofile.h
source3/smbd/nttrans.c
source3/smbd/process.c

index 342c010124a6e62e35c3128eedd9d4764b96a237..1bf5db476806fc26a66a58a1693f637e5aefe9be 100644 (file)
@@ -873,6 +873,7 @@ struct bitmap {
 #define SMBnttranss      0xA1   /* NT transact secondary */
 #define SMBntcreateX     0xA2   /* NT create and X */
 #define SMBntcancel      0xA4   /* NT cancel */
+#define SMBntrename      0xA5   /* NT rename */
 
 /* These are the trans subcommands */
 #define TRANSACT_SETNAMEDPIPEHANDLESTATE  0x01 
index c29a630fe530f291c0d258ee312efc0d59c0f1c0..e494faf7da6358f0b5ca9261ac4eb9ec27cdb792 100644 (file)
@@ -34,7 +34,7 @@ enum flush_reason_enum { SEEK_FLUSH, READ_FLUSH, WRITE_FLUSH, READRAW_FLUSH,
 
 #define PROF_SHMEM_KEY ((key_t)0x07021999)
 #define PROF_SHM_MAGIC 0x6349985
-#define PROF_SHM_VERSION 8
+#define PROF_SHM_VERSION 9
 
 /* time values in the following structure are in microseconds */
 
@@ -259,6 +259,8 @@ struct profile_stats {
        unsigned SMBntcreateX_time;
        unsigned SMBntcancel_count;     /* NT cancel */
        unsigned SMBntcancel_time;
+       unsigned SMBntrename_count;     /* NT rename file */
+       unsigned SMBntrename_time;
        unsigned SMBsplopen_count;      /* open print spool file */
        unsigned SMBsplopen_time;
        unsigned SMBsplwr_count;        /* write to print spool file */
index 075b549a10863fb4c6cc613abaff5375a2b63b3e..954d90b4ad977a9798527417f0987d20df9f2932 100644 (file)
@@ -1489,6 +1489,56 @@ int reply_ntcancel(connection_struct *conn,
        return(-1);
 }
 
+/****************************************************************************
+ Reply to a NT rename request.
+****************************************************************************/
+
+int reply_ntrename(connection_struct *conn,
+                  char *inbuf,char *outbuf,int length,int bufsize)
+{
+       int outsize = 0;
+       pstring name;
+       pstring newname;
+       char *p;
+       NTSTATUS status;
+
+       START_PROFILE(SMBntrename);
+
+       p = smb_buf(inbuf) + 1;
+       p += srvstr_get_path(inbuf, name, p, sizeof(name), STR_TERMINATE,&status);
+       if (!NT_STATUS_IS_OK(status)) {
+               END_PROFILE(SMBntrename);
+               return ERROR_NT(status);
+       }
+       p++;
+       p += srvstr_get_path(inbuf, newname, p, sizeof(newname), STR_TERMINATE,&status);
+       if (!NT_STATUS_IS_OK(status)) {
+               END_PROFILE(SMBntrename);
+               return ERROR_NT(status);
+       }
+       
+       RESOLVE_DFSPATH(name, conn, inbuf, outbuf);
+       RESOLVE_DFSPATH(newname, conn, inbuf, outbuf);
+       
+       DEBUG(3,("reply_ntrename : %s -> %s\n",name,newname));
+       
+       status = rename_internals(conn, name, newname, False);
+       if (!NT_STATUS_IS_OK(status)) {
+               END_PROFILE(SMBntrename);
+               return ERROR_NT(status);
+       }
+
+       /*
+        * Win2k needs a changenotify request response before it will
+        * update after a rename..
+        */     
+       process_pending_change_notify_queue((time_t)0);
+       outsize = set_message(outbuf,0,0,True);
+  
+       END_PROFILE(SMBntrename);
+       return(outsize);
+}
+
 /****************************************************************************
  Reply to an unsolicited SMBNTtranss - just ignore it!
 ****************************************************************************/
index 5206dc70f80b754606c57476f65f61f31dc27777..718d1bb67b2cf11b6c50a8917beab9bbcffca952 100644 (file)
@@ -521,7 +521,7 @@ static const struct smb_message_struct {
 /* 0xa2 */ { "SMBntcreateX", reply_ntcreate_and_X, AS_USER | CAN_IPC | QUEUE_IN_OPLOCK },
 /* 0xa3 */ { NULL, NULL, 0 },
 /* 0xa4 */ { "SMBntcancel", reply_ntcancel, 0 },
-/* 0xa5 */ { NULL, NULL, 0 },
+/* 0xa5 */ { "SMBntrename", reply_ntrename, AS_USER | NEED_WRITE | QUEUE_IN_OPLOCK },
 /* 0xa6 */ { NULL, NULL, 0 },
 /* 0xa7 */ { NULL, NULL, 0 },
 /* 0xa8 */ { NULL, NULL, 0 },