From 23e5cf060d282c9ba9bdf49884ce23a13b285aac Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 13 Mar 2001 00:55:19 +0000 Subject: this patch does a number of things: - removes SMB_ALIGNMENT. That macro caused all sorts of problems with getting unicode aligned right in sub-protocols (such as SMBtrans and SMBtrans2). I believe the performance reasons for having SMB_ALIGNMENT has gone away with the new variants of the SMB protocol anyway, as newer commands tend to have their own internal alignment. - fix the locations where we set smb_flg2 to absolute values. We must never do this if we want a hope of coping with unicode. - add initial support for unicode on the wire in smbd. Currently enabled using SMBD_USE_UNICODE environment variable. (This used to be commit b98b1435e9d8f8622444c9ff33082977e661f16b) --- source3/smbd/nttrans.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'source3/smbd/nttrans.c') diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 1ccac83b78..5eadd2bc8e 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -243,7 +243,7 @@ static int send_nt_replies(char *inbuf, char *outbuf, int bufsize, uint32 nt_err strings in NT calls AND DOESN'T SET THE UNICODE BIT !!!!!!! ****************************************************************************/ -static void get_filename( char *fname, char *inbuf, int data_offset, int data_len, int fname_len) +static void get_filename(char *fname, char *inbuf, int data_offset, int data_len, int fname_len) { /* * We need various heuristics here to detect a unicode string... JRA. @@ -613,7 +613,7 @@ static int do_ntcreate_pipe_open(connection_struct *conn, ((uint32)sizeof(fname)-1)); get_filename(fname, inbuf, smb_buf(inbuf)-inbuf, - smb_buflen(inbuf),fname_len); + smb_buflen(inbuf),fname_len); if ((ret = nt_open_pipe(fname, conn, inbuf, outbuf, &pnum)) != 0) return ret; @@ -725,7 +725,7 @@ int reply_ntcreate_and_X(connection_struct *conn, smb_buflen(inbuf),fname_len); if( strchr(fname, ':')) { - SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES); + SSVAL(outbuf, smb_flg2, SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES); END_PROFILE(SMBntcreateX); return(ERROR(0, NT_STATUS_OBJECT_PATH_NOT_FOUND)); } @@ -866,7 +866,8 @@ int reply_ntcreate_and_X(connection_struct *conn, if (create_options & FILE_NON_DIRECTORY_FILE) { restore_case_semantics(file_attributes); - SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES); + SSVAL(outbuf, smb_flg2, + SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES); END_PROFILE(SMBntcreateX); return(ERROR(0, NT_STATUS_FILE_IS_A_DIRECTORY)); } @@ -1239,7 +1240,7 @@ static int call_nt_transact_create(connection_struct *conn, total_parameter_count - 53 - fname_len, fname_len); if( strchr(fname, ':')) { - SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES); + SSVAL(outbuf, smb_flg2, SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES); return(ERROR(0, NT_STATUS_OBJECT_PATH_NOT_FOUND)); } @@ -1346,7 +1347,8 @@ static int call_nt_transact_create(connection_struct *conn, if (create_options & FILE_NON_DIRECTORY_FILE) { restore_case_semantics(file_attributes); - SSVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES); + SSVAL(outbuf, smb_flg2, + SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES); return(ERROR(0, NT_STATUS_FILE_IS_A_DIRECTORY)); } @@ -1894,8 +1896,7 @@ due to being in oplock break state.\n" )); } if (Protocol >= PROTOCOL_NT1) { - uint16 flg2 = SVAL(outbuf,smb_flg2); - SSVAL(outbuf,smb_flg2,flg2 | 0x40); /* IS_LONG_NAME */ + SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2) | 0x40); /* IS_LONG_NAME */ } /* Now we must call the relevant NT_TRANS function */ -- cgit