diff options
author | Jeremy Allison <jra@samba.org> | 2008-02-28 02:26:16 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2008-02-28 02:26:16 -0800 |
commit | b605b169e659ee0c84f7d807e8dfb25e9723a2bf (patch) | |
tree | 135eecdf76ad181291a5c568c0958637c33ba0c3 | |
parent | 555c9c0702666e56f0cda61441f786d41c2ab6b4 (diff) | |
download | samba-b605b169e659ee0c84f7d807e8dfb25e9723a2bf.tar.gz |
Fix from Guenter Kukkukk <linux@kukkukk.com> to fix listing against
OS/2 servers. OS/2 returns eclass == ERRDOS && ecode == ERRnofiles
for a zero entry directory listing.
Jeremy.
-rw-r--r-- | source/libsmb/clierror.c | 12 | ||||
-rw-r--r-- | source/libsmb/clilist.c | 16 |
2 files changed, 27 insertions, 1 deletions
diff --git a/source/libsmb/clierror.c b/source/libsmb/clierror.c index ff6fbf522fe..cacfe8221c6 100644 --- a/source/libsmb/clierror.c +++ b/source/libsmb/clierror.c @@ -469,3 +469,15 @@ void cli_set_nt_error(struct cli_state *cli, NTSTATUS status) SSVAL(cli->inbuf,smb_flg2, SVAL(cli->inbuf,smb_flg2)|FLAGS2_32_BIT_ERROR_CODES); SIVAL(cli->inbuf, smb_rcls, NT_STATUS_V(status)); } + +/* Reset an error. */ + +void cli_reset_error(struct cli_state *cli) +{ + if (SVAL(cli->inbuf,smb_flg2) & FLAGS2_32_BIT_ERROR_CODES) { + SIVAL(cli->inbuf, smb_rcls, NT_STATUS_V(NT_STATUS_OK)); + } else { + SCVAL(cli->inbuf,smb_rcls,0); + SSVAL(cli->inbuf,smb_err,0); + } +} diff --git a/source/libsmb/clilist.c b/source/libsmb/clilist.c index 3e76cd47754..98c043635f4 100644 --- a/source/libsmb/clilist.c +++ b/source/libsmb/clilist.c @@ -247,7 +247,7 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, &rparam, ¶m_len, &rdata, &data_len) && cli_is_dos_error(cli)) { - /* we need to work around a Win95 bug - sometimes + /* We need to work around a Win95 bug - sometimes it gives ERRSRV/ERRerror temprarily */ uint8 eclass; uint32 ecode; @@ -256,6 +256,20 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, SAFE_FREE(rparam); cli_dos_error(cli, &eclass, &ecode); + + /* + * OS/2 might return "no more files", + * which just tells us, that searchcount is zero + * in this search. + * Guenter Kukkukk <linux@kukkukk.com> + */ + + if (eclass == ERRDOS && ecode == ERRnofiles) { + ff_searchcount = 0; + cli_reset_error(cli); + break; + } + if (eclass != ERRSRV || ecode != ERRerror) break; smb_msleep(100); |