From 52a36db39fb96353702616dfac5004239c34cd2c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 16 Jan 2007 21:04:30 +0000 Subject: r20843: Get rid of last BOOL ok. Jeremy. (This used to be commit a36d446fb612f87654c645f6507d413b95efaf21) --- source3/smbd/reply.c | 117 ++++++++++++++++++++++++++------------------------- 1 file changed, 59 insertions(+), 58 deletions(-) (limited to 'source3/smbd/reply.c') diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index c90c59698f..9a0e544e38 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -895,14 +895,12 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size unsigned int maxentries = 0; BOOL finished = False; char *p; - BOOL ok = False; int status_len; pstring path; char status[21]; int dptr_num= -1; BOOL check_descend = False; BOOL expect_close = False; - BOOL can_open = True; NTSTATUS nt_status; BOOL mask_contains_wcard = False; BOOL allow_long_path_components = (SVAL(inbuf,smb_flg2) & FLAGS2_LONG_PATH_COMPONENTS) ? True : False; @@ -917,8 +915,9 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size *mask = *directory = *fname = 0; /* If we were called as SMBffirst then we must expect close. */ - if(CVAL(inbuf,smb_com) == SMBffirst) + if(CVAL(inbuf,smb_com) == SMBffirst) { expect_close = True; + } outsize = set_message(outbuf,1,3,True); maxentries = SVAL(inbuf,smb_vwv0); @@ -951,8 +950,10 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size } unix_format(dir2); - if (!check_name(directory,conn)) - can_open = False; + if (!check_name(directory,conn)) { + END_PROFILE(SMBsearch); + return UNIXERROR(ERRDOS, ERRnoaccess); + } p = strrchr_m(dir2,'/'); if (p == NULL) { @@ -964,13 +965,15 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size } p = strrchr_m(directory,'/'); - if (!p) + if (!p) { *directory = 0; - else + } else { *p = 0; + } - if (strlen(directory) == 0) + if (strlen(directory) == 0) { pstrcpy(directory,"."); + } memset((char *)status,'\0',21); SCVAL(status,0,(dirtype & 0x1F)); } else { @@ -978,83 +981,81 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size memcpy(status,p,21); status_dirtype = CVAL(status,0) & 0x1F; - if (status_dirtype != (dirtype & 0x1F)) + if (status_dirtype != (dirtype & 0x1F)) { dirtype = status_dirtype; + } conn->dirptr = dptr_fetch(status+12,&dptr_num); - if (!conn->dirptr) + if (!conn->dirptr) { goto SearchEmpty; + } string_set(&conn->dirpath,dptr_path(dptr_num)); pstrcpy(mask, dptr_wcard(dptr_num)); } - if (can_open) { - p = smb_buf(outbuf) + 3; - ok = True; + p = smb_buf(outbuf) + 3; - if (status_len == 0) { - dptr_num = dptr_create(conn,directory,True,expect_close,SVAL(inbuf,smb_pid), mask, mask_contains_wcard, dirtype); - if (dptr_num < 0) { - if(dptr_num == -2) { - END_PROFILE(SMBsearch); - return UNIXERROR(ERRDOS, ERRnofids); - } + if (status_len == 0) { + dptr_num = dptr_create(conn,directory,True,expect_close,SVAL(inbuf,smb_pid), mask, mask_contains_wcard, dirtype); + if (dptr_num < 0) { + if(dptr_num == -2) { END_PROFILE(SMBsearch); - return ERROR_DOS(ERRDOS,ERRnofids); + return UNIXERROR(ERRDOS, ERRnofids); } + END_PROFILE(SMBsearch); + return ERROR_DOS(ERRDOS,ERRnofids); + } + } else { + dirtype = dptr_attr(dptr_num); + } + + DEBUG(4,("dptr_num is %d\n",dptr_num)); + + if ((dirtype&0x1F) == aVOLID) { + memcpy(p,status,21); + make_dir_struct(p,"???????????",volume_label(SNUM(conn)), + 0,aVOLID,0,!allow_long_path_components); + dptr_fill(p+12,dptr_num); + if (dptr_zero(p+12) && (status_len==0)) { + numentries = 1; } else { - dirtype = dptr_attr(dptr_num); + numentries = 0; } + p += DIR_STRUCT_SIZE; + } else { + unsigned int i; + maxentries = MIN(maxentries, ((BUFFER_SIZE - (p - outbuf))/DIR_STRUCT_SIZE)); - DEBUG(4,("dptr_num is %d\n",dptr_num)); + DEBUG(8,("dirpath=<%s> dontdescend=<%s>\n", + conn->dirpath,lp_dontdescend(SNUM(conn)))); + if (in_list(conn->dirpath, lp_dontdescend(SNUM(conn)),True)) { + check_descend = True; + } - if (ok) { - if ((dirtype&0x1F) == aVOLID) { + for (i=numentries;(i dontdescend=<%s>\n", - conn->dirpath,lp_dontdescend(SNUM(conn)))); - if (in_list(conn->dirpath, lp_dontdescend(SNUM(conn)),True)) - check_descend = True; - - for (i=numentries;(i