svn commit: samba r9286 - in branches/SAMBA_3_0/source/smbd: .
jra at samba.org
jra at samba.org
Fri Aug 12 23:45:23 GMT 2005
Author: jra
Date: 2005-08-12 23:45:16 +0000 (Fri, 12 Aug 2005)
New Revision: 9286
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9286
Log:
Fix false positive found by Coverity - wcard must not be null.
Jeremy.
Modified:
branches/SAMBA_3_0/source/smbd/dir.c
Changeset:
Modified: branches/SAMBA_3_0/source/smbd/dir.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/dir.c 2005-08-12 23:45:13 UTC (rev 9285)
+++ branches/SAMBA_3_0/source/smbd/dir.c 2005-08-12 23:45:16 UTC (rev 9286)
@@ -378,6 +378,7 @@
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 @@
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 @@
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",
More information about the samba-cvs
mailing list