author | natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM> |
Tue, 28 Oct 2008 03:34:04 -0700 | |
changeset 7961 | 4b5e3051f38b |
parent 7348 | 73b61202d5d6 |
child 8026 | dd72078b16b2 |
permissions | -rw-r--r-- |
5331 | 1 |
/* |
2 |
* CDDL HEADER START |
|
3 |
* |
|
4 |
* The contents of this file are subject to the terms of the |
|
5 |
* Common Development and Distribution License (the "License"). |
|
6 |
* You may not use this file except in compliance with the License. |
|
7 |
* |
|
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 |
* or http://www.opensolaris.org/os/licensing. |
|
10 |
* See the License for the specific language governing permissions |
|
11 |
* and limitations under the License. |
|
12 |
* |
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 |
* |
|
19 |
* CDDL HEADER END |
|
20 |
*/ |
|
21 |
/* |
|
5772
237ac22142fe
6560095 SNAS shows SIDs for Built-in Groups members instead of name
as200622
parents:
5331
diff
changeset
|
22 |
* Copyright 2008 Sun Microsystems, Inc. All rights reserved. |
5331 | 23 |
* Use is subject to license terms. |
24 |
*/ |
|
25 |
||
26 |
#include <smbsrv/smb_incl.h> |
|
27 |
#include <smbsrv/smb_fsops.h> |
|
28 |
#include <smbsrv/smbinfo.h> |
|
5772
237ac22142fe
6560095 SNAS shows SIDs for Built-in Groups members instead of name
as200622
parents:
5331
diff
changeset
|
29 |
#include <sys/nbmlock.h> |
5331 | 30 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
31 |
static int smb_delete_check_path(smb_request_t *, boolean_t *); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
32 |
static int smb_delete_single_file(smb_request_t *, smb_error_t *); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
33 |
static int smb_delete_multiple_files(smb_request_t *, smb_error_t *); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
34 |
static int smb_delete_find_fname(smb_request_t *, uint32_t *); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
35 |
static int smb_delete_check_attr(smb_request_t *, smb_error_t *); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
36 |
static int smb_delete_remove_file(smb_request_t *, smb_error_t *); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
37 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
38 |
static void smb_delete_error(smb_error_t *, uint32_t, uint16_t, uint16_t); |
5331 | 39 |
|
40 |
/* |
|
41 |
* smb_com_delete |
|
42 |
* |
|
43 |
* The delete file message is sent to delete a data file. The appropriate |
|
44 |
* Tid and additional pathname are passed. Read only files may not be |
|
45 |
* deleted, the read-only attribute must be reset prior to file deletion. |
|
46 |
* |
|
47 |
* NT supports a hidden permission known as File Delete Child (FDC). If |
|
48 |
* the user has FullControl access to a directory, the user is permitted |
|
49 |
* to delete any object in the directory regardless of the permissions |
|
50 |
* on the object. |
|
51 |
* |
|
52 |
* Client Request Description |
|
53 |
* ================================== ================================= |
|
54 |
* UCHAR WordCount; Count of parameter words = 1 |
|
55 |
* USHORT SearchAttributes; |
|
56 |
* USHORT ByteCount; Count of data bytes; min = 2 |
|
57 |
* UCHAR BufferFormat; 0x04 |
|
58 |
* STRING FileName[]; File name |
|
59 |
* |
|
60 |
* Multiple files may be deleted in response to a single request as |
|
61 |
* SMB_COM_DELETE supports wildcards |
|
62 |
* |
|
63 |
* SearchAttributes indicates the attributes that the target file(s) must |
|
64 |
* have. If the attribute is zero then only normal files are deleted. If |
|
65 |
* the system file or hidden attributes are specified then the delete is |
|
66 |
* inclusive -both the specified type(s) of files and normal files are |
|
67 |
* deleted. Attributes are described in the "Attribute Encoding" section |
|
68 |
* of this document. |
|
69 |
* |
|
70 |
* If bit0 of the Flags2 field of the SMB header is set, a pattern is |
|
71 |
* passed in, and the file has a long name, then the passed pattern much |
|
72 |
* match the long file name for the delete to succeed. If bit0 is clear, a |
|
73 |
* pattern is passed in, and the file has a long name, then the passed |
|
74 |
* pattern must match the file's short name for the deletion to succeed. |
|
75 |
* |
|
76 |
* Server Response Description |
|
77 |
* ================================== ================================= |
|
78 |
* UCHAR WordCount; Count of parameter words = 0 |
|
79 |
* USHORT ByteCount; Count of data bytes = 0 |
|
80 |
* |
|
81 |
* 4.2.10.1 Errors |
|
82 |
* |
|
83 |
* ERRDOS/ERRbadpath |
|
84 |
* ERRDOS/ERRbadfile |
|
85 |
* ERRDOS/ERRnoaccess |
|
86 |
* ERRDOS/ERRbadshare # returned by NT for files that are already open |
|
87 |
* ERRHRD/ERRnowrite |
|
88 |
* ERRSRV/ERRaccess |
|
89 |
* ERRSRV/ERRinvdevice |
|
90 |
* ERRSRV/ERRinvid |
|
91 |
* ERRSRV/ERRbaduid |
|
92 |
*/ |
|
6030
6bebab7d43d5
6653315 Want smb interface to associate hostname with network interfaces
jb150015
parents:
5772
diff
changeset
|
93 |
smb_sdrc_t |
6139
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
94 |
smb_pre_delete(smb_request_t *sr) |
5331 | 95 |
{ |
6139
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
96 |
int rc; |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
97 |
smb_fqi_t *fqi; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
98 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
99 |
fqi = &sr->arg.dirop.fqi; |
6139
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
100 |
|
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
101 |
if ((rc = smbsr_decode_vwv(sr, "w", &fqi->srch_attr)) == 0) |
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
102 |
rc = smbsr_decode_data(sr, "%S", sr, &fqi->path); |
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
103 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
104 |
DTRACE_SMB_2(op__Delete__start, smb_request_t *, sr, smb_fqi_t *, fqi); |
6139
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
105 |
|
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
106 |
return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR); |
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
107 |
} |
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
108 |
|
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
109 |
void |
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
110 |
smb_post_delete(smb_request_t *sr) |
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
111 |
{ |
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
112 |
DTRACE_SMB_1(op__Delete__done, smb_request_t *, sr); |
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
113 |
} |
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
114 |
|
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
115 |
/* |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
116 |
* smb_com_delete |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
117 |
* |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
118 |
* 1. pre-process pathname - smb_delete_check_path() |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
119 |
* checks dot, bad path syntax, wildcards in path |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
120 |
* |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
121 |
* 2. process the path to get directory node & last_comp, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
122 |
* store these in fqi |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
123 |
* - If smb_pathname_reduce cannot find the specified path, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
124 |
* the error (ENOTDIR) is translated to NT_STATUS_OBJECT_PATH_NOT_FOUND |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
125 |
* if the target is a single file (no wildcards). If there are |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
126 |
* wildcards in the last_comp, NT_STATUS_OBJECT_NAME_NOT_FOUND is |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
127 |
* used instead. |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
128 |
* - If the directory node is the mount point and the last component |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
129 |
* is ".." NT_STATUS_OBJECT_PATH_SYNTAX_BAD is returned. |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
130 |
* |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
131 |
* 3. check access permissions |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
132 |
* |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
133 |
* 4. invoke the appropriate deletion routine to find and remove |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
134 |
* the specified file(s). |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
135 |
* - if target is a single file (no wildcards) - smb_delete_single_file |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
136 |
* - if the target contains wildcards - smb_delete_multiple_files |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
137 |
* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
138 |
* Returns: SDRC_SUCCESS or SDRC_ERROR |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
139 |
*/ |
6139
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
140 |
smb_sdrc_t |
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
141 |
smb_com_delete(smb_request_t *sr) |
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
142 |
{ |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
143 |
int rc; |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
144 |
smb_error_t err; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
145 |
uint32_t status; |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
146 |
boolean_t wildcards; |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
147 |
smb_fqi_t *fqi; |
5331 | 148 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
149 |
fqi = &sr->arg.dirop.fqi; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
150 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
151 |
if (smb_delete_check_path(sr, &wildcards) != 0) |
6139
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
152 |
return (SDRC_ERROR); |
5772
237ac22142fe
6560095 SNAS shows SIDs for Built-in Groups members instead of name
as200622
parents:
5331
diff
changeset
|
153 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
154 |
rc = smb_pathname_reduce(sr, sr->user_cr, fqi->path, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
155 |
sr->tid_tree->t_snode, sr->tid_tree->t_snode, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
156 |
&fqi->dir_snode, fqi->last_comp); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
157 |
if (rc == 0) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
158 |
if (fqi->dir_snode->vp->v_type != VDIR) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
159 |
smb_node_release(fqi->dir_snode); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
160 |
rc = ENOTDIR; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
161 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
162 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
163 |
if (rc != 0) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
164 |
if (rc == ENOTDIR) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
165 |
if (wildcards) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
166 |
status = NT_STATUS_OBJECT_NAME_NOT_FOUND; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
167 |
else |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
168 |
status = NT_STATUS_OBJECT_PATH_NOT_FOUND; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
169 |
smbsr_error(sr, status, ERRDOS, ERROR_FILE_NOT_FOUND); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
170 |
} else { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
171 |
smbsr_errno(sr, rc); |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
172 |
} |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
173 |
|
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
174 |
return (SDRC_ERROR); |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
175 |
} |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
176 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
177 |
if ((fqi->dir_snode == sr->tid_tree->t_snode) && |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
178 |
(strcmp(fqi->last_comp, "..") == 0)) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
179 |
smb_node_release(fqi->dir_snode); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
180 |
smbsr_error(sr, NT_STATUS_OBJECT_PATH_SYNTAX_BAD, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
181 |
ERRDOS, ERROR_BAD_PATHNAME); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
182 |
return (SDRC_ERROR); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
183 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
184 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
185 |
rc = smb_fsop_access(sr, sr->user_cr, fqi->dir_snode, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
186 |
FILE_LIST_DIRECTORY); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
187 |
if (rc != 0) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
188 |
smb_node_release(fqi->dir_snode); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
189 |
smbsr_error(sr, NT_STATUS_ACCESS_DENIED, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
190 |
ERRDOS, ERROR_ACCESS_DENIED); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
191 |
return (SDRC_ERROR); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
192 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
193 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
194 |
if (wildcards) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
195 |
rc = smb_delete_multiple_files(sr, &err); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
196 |
else |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
197 |
rc = smb_delete_single_file(sr, &err); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
198 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
199 |
if (rc != 0) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
200 |
smbsr_set_error(sr, &err); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
201 |
else |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
202 |
rc = smbsr_encode_empty_result(sr); |
5331 | 203 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
204 |
return (rc == 0 ? SDRC_SUCCESS : SDRC_ERROR); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
205 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
206 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
207 |
/* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
208 |
* smb_delete_single_file |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
209 |
* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
210 |
* Find the specified file and, if its attributes match the search |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
211 |
* criteria, delete it. |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
212 |
* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
213 |
* Returns 0 - success (file deleted) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
214 |
* -1 - error, err is populated with error details |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
215 |
*/ |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
216 |
static int |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
217 |
smb_delete_single_file(smb_request_t *sr, smb_error_t *err) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
218 |
{ |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
219 |
smb_fqi_t *fqi; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
220 |
smb_attr_t ret_attr; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
221 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
222 |
fqi = &sr->arg.dirop.fqi; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
223 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
224 |
if (smb_fsop_lookup_name(sr, sr->user_cr, 0, sr->tid_tree->t_snode, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
225 |
fqi->dir_snode, fqi->last_comp, &fqi->last_snode, &ret_attr) != 0) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
226 |
smb_delete_error(err, NT_STATUS_OBJECT_NAME_NOT_FOUND, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
227 |
ERRDOS, ERROR_FILE_NOT_FOUND); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
228 |
return (-1); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
229 |
} |
5331 | 230 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
231 |
if (smb_delete_check_attr(sr, err) != 0) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
232 |
smb_node_release(fqi->last_snode); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
233 |
return (-1); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
234 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
235 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
236 |
if (smb_delete_remove_file(sr, err) != 0) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
237 |
smb_node_release(fqi->last_snode); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
238 |
return (-1); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
239 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
240 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
241 |
smb_node_release(fqi->last_snode); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
242 |
return (0); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
243 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
244 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
245 |
/* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
246 |
* smb_delete_multiple_files |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
247 |
* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
248 |
* For each matching file found by smb_delete_find_name: |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
249 |
* 1. lookup file |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
250 |
* 2. check the file's attributes |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
251 |
* - The search ends with an error if a readonly file |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
252 |
* (NT_STATUS_CANNOT_DELETE) is matched. |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
253 |
* - The search ends (but not an error) if a directory is |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
254 |
* matched and the request's search did not include |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
255 |
* directories. |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
256 |
* - Otherwise, if smb_delete_check_attr fails the file |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
257 |
* is skipped and the search continues (at step 1) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
258 |
* 3. delete the file |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
259 |
* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
260 |
* Returns 0 - success |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
261 |
* -1 - error, err is populated with error details |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
262 |
*/ |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
263 |
static int |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
264 |
smb_delete_multiple_files(smb_request_t *sr, smb_error_t *err) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
265 |
{ |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
266 |
int rc, deleted = 0; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
267 |
uint32_t cookie = 0; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
268 |
smb_fqi_t *fqi; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
269 |
smb_attr_t ret_attr; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
270 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
271 |
fqi = &sr->arg.dirop.fqi; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
272 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
273 |
for (;;) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
274 |
rc = smb_delete_find_fname(sr, &cookie); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
275 |
if (rc != 0) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
276 |
break; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
277 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
278 |
rc = smb_fsop_lookup_name(sr, sr->user_cr, 0, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
279 |
sr->tid_tree->t_snode, fqi->dir_snode, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
280 |
fqi->last_comp_od, &fqi->last_snode, &ret_attr); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
281 |
if (rc != 0) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
282 |
break; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
283 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
284 |
if (smb_delete_check_attr(sr, err) != 0) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
285 |
smb_node_release(fqi->last_snode); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
286 |
if (err->status == NT_STATUS_CANNOT_DELETE) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
287 |
return (-1); |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
288 |
} |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
289 |
if ((err->status == NT_STATUS_FILE_IS_A_DIRECTORY) && |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
290 |
(SMB_SEARCH_DIRECTORY(fqi->srch_attr) != 0)) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
291 |
break; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
292 |
continue; |
5772
237ac22142fe
6560095 SNAS shows SIDs for Built-in Groups members instead of name
as200622
parents:
5331
diff
changeset
|
293 |
} |
237ac22142fe
6560095 SNAS shows SIDs for Built-in Groups members instead of name
as200622
parents:
5331
diff
changeset
|
294 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
295 |
if (smb_delete_remove_file(sr, err) == 0) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
296 |
++deleted; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
297 |
smb_node_release(fqi->last_snode); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
298 |
continue; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
299 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
300 |
if (err->status == NT_STATUS_OBJECT_NAME_NOT_FOUND) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
301 |
smb_node_release(fqi->last_snode); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
302 |
continue; |
5331 | 303 |
} |
304 |
||
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
305 |
smb_node_release(fqi->last_snode); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
306 |
return (-1); |
5331 | 307 |
} |
308 |
||
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
309 |
|
5331 | 310 |
if ((rc != 0) && (rc != ENOENT)) { |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
311 |
smbsr_map_errno(rc, err); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
312 |
return (-1); |
5331 | 313 |
} |
314 |
||
315 |
if (deleted == 0) { |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
316 |
smb_delete_error(err, NT_STATUS_NO_SUCH_FILE, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
317 |
ERRDOS, ERROR_FILE_NOT_FOUND); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
318 |
return (-1); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
319 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
320 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
321 |
return (0); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
322 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
323 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
324 |
/* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
325 |
* smb_delete_find_fname |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
326 |
* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
327 |
* Find next filename that matches search pattern (fqi->last_comp) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
328 |
* and save it in fqi->last_comp_od. |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
329 |
* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
330 |
* Returns: 0 - success |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
331 |
* errno |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
332 |
*/ |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
333 |
static int |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
334 |
smb_delete_find_fname(smb_request_t *sr, uint32_t *cookie) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
335 |
{ |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
336 |
int rc, n_name; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
337 |
ino64_t fileid; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
338 |
smb_fqi_t *fqi; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
339 |
char name83[SMB_SHORTNAMELEN]; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
340 |
char shortname[SMB_SHORTNAMELEN]; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
341 |
boolean_t ignore_case; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
342 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
343 |
fqi = &sr->arg.dirop.fqi; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
344 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
345 |
ignore_case = SMB_TREE_IS_CASEINSENSITIVE(sr); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
346 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
347 |
for (;;) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
348 |
n_name = sizeof (fqi->last_comp_od) - 1; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
349 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
350 |
rc = smb_fsop_readdir(sr, sr->user_cr, fqi->dir_snode, cookie, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
351 |
fqi->last_comp_od, &n_name, &fileid, NULL, NULL, NULL); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
352 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
353 |
if (rc != 0) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
354 |
return (rc); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
355 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
356 |
/* check for EOF */ |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
357 |
if (n_name == 0) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
358 |
return (ENOENT); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
359 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
360 |
fqi->last_comp_od[n_name] = '\0'; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
361 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
362 |
if (smb_match_name(fileid, fqi->last_comp_od, shortname, name83, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
363 |
fqi->last_comp, ignore_case)) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
364 |
return (0); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
365 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
366 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
367 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
368 |
/* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
369 |
* smb_delete_check_attr |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
370 |
* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
371 |
* Check file's dos atributes to ensure that |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
372 |
* 1. the file is not a directory - NT_STATUS_FILE_IS_A_DIRECTORY |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
373 |
* 2. the file is not readonly - NT_STATUS_CANNOT_DELETE |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
374 |
* 3. the file's dos attributes comply with the specified search attributes |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
375 |
* If the file is either hidden or system and those attributes |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
376 |
* are not specified in the search attributes - NT_STATUS_NO_SUCH_FILE |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
377 |
* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
378 |
* Returns: 0 - file's attributes pass all checks |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
379 |
* -1 - err populated with error details |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
380 |
*/ |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
381 |
static int |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
382 |
smb_delete_check_attr(smb_request_t *sr, smb_error_t *err) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
383 |
{ |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
384 |
smb_fqi_t *fqi; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
385 |
smb_node_t *node; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
386 |
uint16_t dosattr, sattr; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
387 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
388 |
fqi = &sr->arg.dirop.fqi; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
389 |
sattr = fqi->srch_attr; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
390 |
node = fqi->last_snode; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
391 |
dosattr = smb_node_get_dosattr(node); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
392 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
393 |
if (dosattr & FILE_ATTRIBUTE_DIRECTORY) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
394 |
smb_delete_error(err, NT_STATUS_FILE_IS_A_DIRECTORY, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
395 |
ERRDOS, ERROR_ACCESS_DENIED); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
396 |
return (-1); |
5331 | 397 |
} |
398 |
||
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
399 |
if (SMB_PATHFILE_IS_READONLY(sr, node)) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
400 |
smb_delete_error(err, NT_STATUS_CANNOT_DELETE, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
401 |
ERRDOS, ERROR_ACCESS_DENIED); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
402 |
return (-1); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
403 |
} |
6030
6bebab7d43d5
6653315 Want smb interface to associate hostname with network interfaces
jb150015
parents:
5772
diff
changeset
|
404 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
405 |
if ((dosattr & FILE_ATTRIBUTE_HIDDEN) && !(SMB_SEARCH_HIDDEN(sattr))) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
406 |
smb_delete_error(err, NT_STATUS_NO_SUCH_FILE, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
407 |
ERRDOS, ERROR_FILE_NOT_FOUND); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
408 |
return (-1); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
409 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
410 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
411 |
if ((dosattr & FILE_ATTRIBUTE_SYSTEM) && !(SMB_SEARCH_SYSTEM(sattr))) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
412 |
smb_delete_error(err, NT_STATUS_NO_SUCH_FILE, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
413 |
ERRDOS, ERROR_FILE_NOT_FOUND); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
414 |
return (-1); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
415 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
416 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
417 |
return (0); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
418 |
} |
5331 | 419 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
420 |
/* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
421 |
* smb_delete_remove_file |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
422 |
* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
423 |
* For consistency with Windows 2000, the range check should be done |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
424 |
* after checking for sharing violations. Attempting to delete a |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
425 |
* locked file will result in sharing violation, which is the same |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
426 |
* thing that will happen if you try to delete a non-locked open file. |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
427 |
* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
428 |
* Note that windows 2000 rejects lock requests on open files that |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
429 |
* have been opened with metadata open modes. The error is |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
430 |
* STATUS_ACCESS_DENIED. |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
431 |
* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
432 |
* NT does not always close a file immediately, which can cause the |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
433 |
* share and access checking to fail (the node refcnt is greater |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
434 |
* than one), and the file doesn't get deleted. Breaking the oplock |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
435 |
* before share and access checking gives the client a chance to |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
436 |
* close the file. |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
437 |
* |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
438 |
* Returns: 0 - success |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
439 |
* -1 - error, err populated with error details |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
440 |
*/ |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
441 |
static int |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
442 |
smb_delete_remove_file(smb_request_t *sr, smb_error_t *err) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
443 |
{ |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
444 |
int rc; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
445 |
uint32_t status; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
446 |
smb_fqi_t *fqi; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
447 |
smb_node_t *node; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
448 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
449 |
fqi = &sr->arg.dirop.fqi; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
450 |
node = fqi->last_snode; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
451 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
452 |
smb_oplock_break(node); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
453 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
454 |
smb_node_start_crit(node, RW_READER); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
455 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
456 |
status = smb_node_delete_check(node); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
457 |
if (status != NT_STATUS_SUCCESS) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
458 |
smb_delete_error(err, NT_STATUS_SHARING_VIOLATION, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
459 |
ERRDOS, ERROR_SHARING_VIOLATION); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
460 |
smb_node_end_crit(node); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
461 |
return (-1); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
462 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
463 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
464 |
status = smb_range_check(sr, node, 0, UINT64_MAX, B_TRUE); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
465 |
if (status != NT_STATUS_SUCCESS) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
466 |
smb_delete_error(err, NT_STATUS_ACCESS_DENIED, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
467 |
ERRDOS, ERROR_ACCESS_DENIED); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
468 |
smb_node_end_crit(node); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
469 |
return (-1); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
470 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
471 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
472 |
rc = smb_fsop_remove(sr, sr->user_cr, node->dir_snode, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
473 |
node->od_name, 1); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
474 |
if (rc != 0) { |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
475 |
if (rc == ENOENT) |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
476 |
smb_delete_error(err, NT_STATUS_OBJECT_NAME_NOT_FOUND, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
477 |
ERRDOS, ERROR_FILE_NOT_FOUND); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
478 |
else |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
479 |
smbsr_map_errno(rc, err); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
480 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
481 |
smb_node_end_crit(node); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
482 |
return (-1); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
483 |
} |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
484 |
|
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
485 |
smb_node_end_crit(node); |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
486 |
return (0); |
5331 | 487 |
} |
488 |
||
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
489 |
|
6139
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
490 |
/* |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
491 |
* smb_delete_check_path |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
492 |
* |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
493 |
* Perform initial validation on the pathname and last_comp. |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
494 |
* |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
495 |
* wildcards in path: |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
496 |
* Wildcards in the path (excluding the last_comp) should result |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
497 |
* in NT_STATUS_OBJECT_NAME_INVALID. |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
498 |
* |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
499 |
* bad path syntax: |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
500 |
* On unix .. at the root of a file system links to the root. Thus |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
501 |
* an attempt to lookup "/../../.." will be the same as looking up "/" |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
502 |
* CIFs clients expect the above to result in |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
503 |
* NT_STATUS_OBJECT_PATH_SYNTAX_BAD. It is currently not possible |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
504 |
* (and questionable if it's desirable) to deal with all cases |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
505 |
* but paths beginning with \\.. are handled. See bad_paths[]. |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
506 |
* Cases like "\\dir\\..\\.." will be caught and handled after the |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
507 |
* pnreduce. Cases like "\\dir\\..\\..\\filename" will still result |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
508 |
* in "\\filename" which is contrary to windows behavior. |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
509 |
* |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
510 |
* dot: |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
511 |
* A filename of '.' should result in NT_STATUS_OBJECT_NAME_INVALID |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
512 |
* Any wildcard filename that resolves to '.' should result in |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
513 |
* NT_STATUS_OBJECT_NAME_INVALID if the search attributes include |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
514 |
* FILE_ATTRIBUTE_DIRECTORY |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
515 |
* |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
516 |
* Returns: |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
517 |
* 0: path is valid. Sets *wildcard to TRUE if wildcard delete |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
518 |
* i.e. if wildcards in last component |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
519 |
* -1: path is invalid. Sets error information in sr. |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
520 |
*/ |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
521 |
static int |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
522 |
smb_delete_check_path(smb_request_t *sr, boolean_t *wildcard) |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
523 |
{ |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
524 |
smb_fqi_t *fqi = &sr->arg.dirop.fqi; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
525 |
char *p, *last_comp; |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
526 |
int i, wildcards; |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
527 |
|
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
528 |
struct { |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
529 |
char *name; |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
530 |
int len; |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
531 |
} *bad, bad_paths[] = { |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
532 |
{"\\..\0", 4}, |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
533 |
{"\\..\\", 4}, |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
534 |
{"..\0", 3}, |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
535 |
{"..\\", 3} |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
536 |
}; |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
537 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
538 |
/* check for wildcards in path */ |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
539 |
wildcards = smb_convert_unicode_wildcards(fqi->path); |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
540 |
|
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
541 |
/* find last component, strip trailing '\\' */ |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
542 |
p = fqi->path + strlen(fqi->path) - 1; |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
543 |
while (*p == '\\') { |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
544 |
*p = '\0'; |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
545 |
--p; |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
546 |
} |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
547 |
if ((p = strrchr(fqi->path, '\\')) == NULL) { |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
548 |
last_comp = fqi->path; |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
549 |
} else { |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
550 |
last_comp = ++p; |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
551 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
552 |
/* wildcards in path > wildcards in last_comp */ |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
553 |
if (smb_convert_unicode_wildcards(last_comp) != wildcards) { |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
554 |
smbsr_error(sr, NT_STATUS_OBJECT_NAME_INVALID, |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
555 |
ERRDOS, ERROR_INVALID_NAME); |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
556 |
return (-1); |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
557 |
} |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
558 |
} |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
559 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
560 |
/* path above the mount point */ |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
561 |
for (i = 0; i < sizeof (bad_paths) / sizeof (bad_paths[0]); ++i) { |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
562 |
bad = &bad_paths[i]; |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
563 |
if (strncmp(fqi->path, bad->name, bad->len) == 0) { |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
564 |
smbsr_error(sr, NT_STATUS_OBJECT_PATH_SYNTAX_BAD, |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
565 |
ERRDOS, ERROR_BAD_PATHNAME); |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
566 |
return (-1); |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
567 |
} |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
568 |
} |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
569 |
|
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
570 |
/* last component is, or resolves to, '.' (dot) */ |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
571 |
if ((strcmp(last_comp, ".") == 0) || |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
572 |
(SMB_SEARCH_DIRECTORY(fqi->srch_attr) && |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
573 |
(smb_match(last_comp, ".")))) { |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
574 |
smbsr_error(sr, NT_STATUS_OBJECT_NAME_INVALID, |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
575 |
ERRDOS, ERROR_INVALID_NAME); |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
576 |
return (-1); |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
577 |
} |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
578 |
|
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
579 |
*wildcard = (wildcards != 0); |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
580 |
return (0); |
7348
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
581 |
} |
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
582 |
|
73b61202d5d6
6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents:
7052
diff
changeset
|
583 |
/* |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
584 |
* smb_delete_error |
6139
5c743b207bf9
6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
6030
diff
changeset
|
585 |
*/ |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
586 |
static void |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
587 |
smb_delete_error(smb_error_t *err, |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
588 |
uint32_t status, uint16_t errcls, uint16_t errcode) |
5331 | 589 |
{ |
7961
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
590 |
err->severity = ERROR_SEVERITY_ERROR; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
591 |
err->status = status; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
592 |
err->errcls = errcls; |
4b5e3051f38b
6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory
natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
parents:
7348
diff
changeset
|
593 |
err->errcode = errcode; |
5331 | 594 |
} |