Fix reply_ctemp - make compatible with w2k3.
authorJeremy Allison <jra@samba.org>
Fri, 2 Apr 2004 22:11:08 +0000 (22:11 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 2 Apr 2004 22:11:08 +0000 (22:11 +0000)
Jeremy.
(This used to be commit ddb40a6b1cfed9022dadc627b38d3c3938e8e6b4)

source3/smbd/reply.c

index 9f311c6d576aeb7f968b52f09446bc9e81339cd3..130601cd9c684c5e57e341449c67dbc1fd56ba08 100644 (file)
@@ -1293,6 +1293,7 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
        SMB_STRUCT_STAT sbuf;
        char *p, *s;
        NTSTATUS status;
+       unsigned int namelen;
 
        START_PROFILE(SMBctemp);
 
@@ -1302,7 +1303,11 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
                END_PROFILE(SMBctemp);
                return ERROR_NT(status);
        }
-       pstrcat(fname,"\\TMXXXXXX");
+       if (*fname) {
+               pstrcat(fname,"/TMXXXXXX");
+       } else {
+               pstrcat(fname,"TMXXXXXX");
+       }
 
        RESOLVE_DFSPATH(fname, conn, inbuf, outbuf);
 
@@ -1342,10 +1347,13 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
                s++;
 
        p = smb_buf(outbuf);
+#if 0
+       /* Tested vs W2K3 - this doesn't seem to be here - null terminated filename is the only
+          thing in the byte section. JRA */
        SSVALS(p, 0, -1); /* what is this? not in spec */
-       SSVAL(p, 2, strlen(s));
-       p += 4;
-       p += srvstr_push(outbuf, p, s, -1, STR_ASCII);
+#endif
+       namelen = srvstr_push(outbuf, p, s, -1, STR_ASCII|STR_TERMINATE);
+       p += namelen;
        outsize = set_message_end(outbuf, p);
 
        if (oplock_request && lp_fake_oplocks(SNUM(conn)))