summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-02-21 04:26:32 +0000
committerAndrew Tridgell <tridge@samba.org>2002-02-21 04:26:32 +0000
commit93ea4825972c80957946ac5ef722853a95ccb31c (patch)
tree8437b25d7836278164fd14f6c4c62d53d5a8f29c /source3
parent0cbcf49f6cfb91a7251baa5339795436308578ea (diff)
downloadsamba-93ea4825972c80957946ac5ef722853a95ccb31c.tar.gz
samba-93ea4825972c80957946ac5ef722853a95ccb31c.tar.bz2
samba-93ea4825972c80957946ac5ef722853a95ccb31c.zip
this fixes the security tab on mapped drives for unicode clients.
Jeremy, this is wrong in 2.2.x (This used to be commit 367358c7389555f413b3c690c012ef067859fc22)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/trans2.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 6a089cc429..84ab7286e5 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1431,7 +1431,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
SMB_OFF_T allocation_size=0;
unsigned int data_size;
SMB_STRUCT_STAT sbuf;
- pstring fname;
+ pstring fname, dos_fname;
char *base_name;
char *p;
SMB_OFF_T pos = 0;
@@ -1552,6 +1552,13 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
sbuf.st_mtime &= ~1;
}
+ /* NT expects the name to be in an exact form */
+ if (strequal(fname,".")) {
+ pstrcpy(dos_fname, "\\");
+ } else {
+ snprintf(dos_fname, sizeof(dos_fname), "\\%s", fname);
+ }
+
switch (info_level) {
case SMB_INFO_STANDARD:
case SMB_INFO_QUERY_EA_SIZE:
@@ -1645,16 +1652,9 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
case SMB_QUERY_FILE_NAME_INFO:
/*
- * The first part of this code is essential
- * to get security descriptors to work on mapped
- * drives. Don't ask how I discovered this unless
- * you like hearing about me suffering.... :-). JRA.
+ this must be *exactly* right for ACLs on mapped drives to work
*/
- if(strequal(".", fname)) {
- len = srvstr_push(outbuf, pdata+4, "\\", -1, STR_TERMINATE);
- } else {
- len = srvstr_push(outbuf, pdata+4, fname, -1, STR_TERMINATE);
- }
+ len = srvstr_push(outbuf, pdata+4, dos_fname, -1, STR_UNICODE);
data_size = 4 + len;
SIVAL(pdata,0,len);
break;
@@ -1697,7 +1697,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
SIVAL(pdata,0,mode); /* is this the right sort of mode info? */
pdata += 4;
pdata += 4; /* alignment */
- len = srvstr_push(outbuf, pdata+4, fname, -1, STR_TERMINATE);
+ len = srvstr_push(outbuf, pdata+4, dos_fname, -1, STR_TERMINATE);
SIVAL(pdata,0,len);
pdata += 4 + len;
data_size = PTR_DIFF(pdata,(*ppdata));
@@ -1718,12 +1718,8 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
case SMB_FILE_NAME_INFORMATION:
/* Pathname with leading '\'. */
{
- pstring new_fname;
size_t byte_len;
-
- pstrcpy(new_fname, "\\");
- pstrcat(new_fname, fname);
- byte_len = dos_PutUniCode(pdata+4,new_fname,max_data_bytes,False);
+ byte_len = dos_PutUniCode(pdata+4,dos_fname,max_data_bytes,False);
SIVAL(pdata,0,byte_len);
data_size = 4 + byte_len;
break;
@@ -1753,9 +1749,6 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
/* Not yet finished... JRA */
case 1018:
{
- pstring new_fname;
- size_t byte_len;
-
put_long_date(pdata,c_time);
put_long_date(pdata+8,sbuf.st_atime);
put_long_date(pdata+16,sbuf.st_mtime); /* write time */