summaryrefslogtreecommitdiff
path: root/source3/client
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-02-24 19:10:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:55:46 -0500
commit584c412e0a87bb73d41e260f93b9915286888ba2 (patch)
treebe9a164e2c4a14415ec4425a81a01a67d125948d /source3/client
parentc3a5d90db43e6340e974f879f0c3b9c361bf3bb9 (diff)
downloadsamba-584c412e0a87bb73d41e260f93b9915286888ba2.tar.gz
samba-584c412e0a87bb73d41e260f93b9915286888ba2.tar.bz2
samba-584c412e0a87bb73d41e260f93b9915286888ba2.zip
r5542: fix a few more msdfs bugs in smbclient against both smbd and 2k dfs root
shares. (This used to be commit 5d2624c453b0bc961302edd9f2421a7c3d504d1f)
Diffstat (limited to 'source3/client')
-rw-r--r--source3/client/client.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index bee980d907..6a9e57f86f 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -498,6 +498,9 @@ static int do_cd(char *newdir)
pstring dname;
pstring targetpath;
struct cli_state *targetcli;
+ SMB_STRUCT_STAT sbuf;
+ uint32 attributes;
+ pstring fullpath;
dos_format(newdir);
@@ -513,7 +516,7 @@ static int do_cd(char *newdir)
if (*(cur_dir+strlen(cur_dir)-1) != '\\') {
pstrcat(cur_dir, "\\");
}
-
+
dos_clean_name(cur_dir);
pstrcpy( dname, cur_dir );
pstrcat(cur_dir,"\\");
@@ -522,18 +525,39 @@ static int do_cd(char *newdir)
if ( !cli_resolve_path( cli, dname, &targetcli, targetpath ) ) {
d_printf("cd %s: %s\n", dname, cli_errstr(cli));
pstrcpy(cur_dir,saved_dir);
+ goto out;
}
- pstrcat( targetpath, "\\" );
- dos_clean_name( targetpath );
-
- if ( !strequal(targetpath,"\\") ) {
+
+ if ( strequal(targetpath,"\\" ) )
+ return 0;
+
+ /* use a trans2_qpathinfo to test directories for modern servers */
+
+ if ( targetcli->protocol >= PROTOCOL_LANMAN2 ) {
+ if ( !cli_qpathinfo_basic( targetcli, targetpath, &sbuf, &attributes ) ) {
+ d_printf("cd %s: %s\n", dname, cli_errstr(targetcli));
+ pstrcpy(cur_dir,saved_dir);
+ goto out;
+ }
+
+ if ( !(attributes&FILE_ATTRIBUTE_DIRECTORY) ) {
+ d_printf("cd %s: not a directory\n", dname);
+ pstrcpy(cur_dir,saved_dir);
+ goto out;
+ }
+ }
+ else {
+ pstrcat( targetpath, "\\" );
+ dos_clean_name( targetpath );
+
if ( !cli_chkpath(targetcli, targetpath) ) {
d_printf("cd %s: %s\n", dname, cli_errstr(targetcli));
pstrcpy(cur_dir,saved_dir);
}
}
+out:
pstrcpy(cd_path,cur_dir);
return 0;