summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-08-12 23:45:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:00:31 -0500
commit15b842d401beebc304c98e855c33421782c51a85 (patch)
tree0d0970f09287ea16933ac61ef88ef2af5b19c150
parente04754b295acdea6d2ea365bb0a3935a5976a3a2 (diff)
downloadsamba-15b842d401beebc304c98e855c33421782c51a85.tar.gz
samba-15b842d401beebc304c98e855c33421782c51a85.tar.xz
samba-15b842d401beebc304c98e855c33421782c51a85.zip
r9286: Fix false positive found by Coverity - wcard must not be null.
Jeremy. (This used to be commit 31104e5bcfffdd48071b2062809313679f29961f)
-rw-r--r--source3/smbd/dir.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index a0df924dc7c..159ce372366 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -378,6 +378,7 @@ static void dptr_close_oldest(BOOL old)
one byte long. If old_handle is false we allocate from the range
256 - MAX_DIRECTORY_HANDLES. We bias the number we return by 1 to ensure
a directory handle is never zero.
+ wcard must not be zero.
****************************************************************************/
int dptr_create(connection_struct *conn, pstring path, BOOL old_handle, BOOL expect_close,uint16 spid,
@@ -389,6 +390,10 @@ int dptr_create(connection_struct *conn, pstring path, BOOL old_handle, BOOL exp
DEBUG(5,("dptr_create dir=%s\n", path));
+ if (!wcard) {
+ return -1;
+ }
+
if (!check_name(path,conn))
return(-2); /* Code to say use a unix error return code. */
@@ -485,24 +490,21 @@ int dptr_create(connection_struct *conn, pstring path, BOOL old_handle, BOOL exp
dptr->dir_hnd = dir_hnd;
dptr->spid = spid;
dptr->expect_close = expect_close;
- if (wcard) {
- dptr->wcard = SMB_STRDUP(wcard);
- if (!dptr->wcard) {
- bitmap_clear(dptr_bmap, dptr->dnum - 1);
- SAFE_FREE(dptr);
- CloseDir(dir_hnd);
- return -1;
- }
- } else {
- dptr->wcard = NULL;
+ dptr->wcard = SMB_STRDUP(wcard);
+ if (!dptr->wcard) {
+ bitmap_clear(dptr_bmap, dptr->dnum - 1);
+ SAFE_FREE(dptr);
+ CloseDir(dir_hnd);
+ return -1;
}
- dptr->attr = attr;
- if (lp_posix_pathnames() || (wcard && (wcard[0] == '.' && wcard[1] == 0))) {
+ if (lp_posix_pathnames() || (wcard[0] == '.' && wcard[1] == 0)) {
dptr->has_wild = True;
} else {
dptr->has_wild = ms_has_wild(wcard);
}
+ dptr->attr = attr;
+
DLIST_ADD(dirptrs, dptr);
DEBUG(3,("creating new dirptr %d for path %s, expect_close = %d\n",