summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-09-27 04:46:18 +0200
committerVolker Lendecke <vl@samba.org>2010-09-28 07:36:18 +0200
commit3009178ee5fc054c284568768d5acdf0208a25f4 (patch)
treef799b29cc39ea1b7c0913b854537049126f5ca53
parente57811440ad7b407cdd51dfcf3476072d461bcb7 (diff)
downloadsamba-3009178ee5fc054c284568768d5acdf0208a25f4.tar.gz
samba-3009178ee5fc054c284568768d5acdf0208a25f4.tar.bz2
samba-3009178ee5fc054c284568768d5acdf0208a25f4.zip
s3: Slightly simplify file_fnum
req==NULL should never happen, see the comment
-rw-r--r--source3/smbd/files.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index ef0da8f1e4..3695b50d05 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -513,12 +513,25 @@ files_struct *file_fsp(struct smb_request *req, uint16 fid)
{
files_struct *fsp;
- if ((req != NULL) && (req->chain_fsp != NULL)) {
+ if (req == NULL) {
+ /*
+ * We should never get here. req==NULL could in theory
+ * only happen from internal opens with a non-zero
+ * root_dir_fid. Internal opens just don't do that, at
+ * least they are not supposed to do so. And if they
+ * start to do so, they better fake up a smb_request
+ * from which we get the right smbd_server_conn. While
+ * this should never happen, let's return NULL here.
+ */
+ return NULL;
+ }
+
+ if (req->chain_fsp != NULL) {
return req->chain_fsp;
}
fsp = file_fnum(smbd_server_conn, fid);
- if ((fsp != NULL) && (req != NULL)) {
+ if (fsp != NULL) {
req->chain_fsp = fsp;
}
return fsp;