|
Lines 21-35
Link Here
|
| 21 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
21 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 22 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
22 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 |
*/ |
23 |
*/ |
| 24 |
|
|
|
| 25 |
/* |
| 26 |
Modified 2003 May 30 by Lawrence D'Oliveiro, ldo@geek-central.gen.nz: |
| 27 |
quick hack to get around problem doing directory listings on |
| 28 |
NFS-mounted volumes under Tru64 UNIX 5.1 where, after readdir |
| 29 |
returns NULL to indicate the end of the listing, if it is called |
| 30 |
again, it starts returning the directory listing from the |
| 31 |
beginning. |
| 32 |
*/ |
| 33 |
#include "includes.h" |
24 |
#include "includes.h" |
| 34 |
RCSID("$OpenBSD: sftp-server.c,v 1.41 2003/03/26 04:02:51 deraadt Exp $"); |
25 |
RCSID("$OpenBSD: sftp-server.c,v 1.41 2003/03/26 04:02:51 deraadt Exp $"); |
| 35 |
|
26 |
|
|
Lines 138-144
Link Here
|
| 138 |
DIR *dirp; |
129 |
DIR *dirp; |
| 139 |
int fd; |
130 |
int fd; |
| 140 |
char *name; |
131 |
char *name; |
| 141 |
int EndReached; /* LDO */ |
|
|
| 142 |
}; |
132 |
}; |
| 143 |
|
133 |
|
| 144 |
enum { |
134 |
enum { |
|
Lines 697-703
Link Here
|
| 697 |
if (handle < 0) { |
687 |
if (handle < 0) { |
| 698 |
closedir(dirp); |
688 |
closedir(dirp); |
| 699 |
} else { |
689 |
} else { |
| 700 |
handles[handle].EndReached = 0; /* LDO */ |
|
|
| 701 |
send_handle(id, handle); |
690 |
send_handle(id, handle); |
| 702 |
status = SSH2_FX_OK; |
691 |
status = SSH2_FX_OK; |
| 703 |
} |
692 |
} |
|
Lines 731-746
Link Here
|
| 731 |
int nstats = 10, count = 0, i; |
720 |
int nstats = 10, count = 0, i; |
| 732 |
|
721 |
|
| 733 |
stats = xmalloc(nstats * sizeof(Stat)); |
722 |
stats = xmalloc(nstats * sizeof(Stat)); |
| 734 |
for (;;) /* LDO */ |
723 |
while ((dp = readdir(dirp)) != NULL) { |
| 735 |
{ |
|
|
| 736 |
if (handles[handle].EndReached) |
| 737 |
break; |
| 738 |
dp = readdir(dirp); |
| 739 |
if (dp == NULL) |
| 740 |
{ |
| 741 |
handles[handle].EndReached = 1; |
| 742 |
break; |
| 743 |
} /*if*/ |
| 744 |
if (count >= nstats) { |
724 |
if (count >= nstats) { |
| 745 |
nstats *= 2; |
725 |
nstats *= 2; |
| 746 |
stats = xrealloc(stats, nstats * sizeof(Stat)); |
726 |
stats = xrealloc(stats, nstats * sizeof(Stat)); |