svn commit: samba r9629 - in branches/SOC/SAMBA_3_0/source/client: .
kalim at samba.org
kalim at samba.org
Fri Aug 26 04:23:42 GMT 2005
Author: kalim
Date: 2005-08-26 04:23:41 +0000 (Fri, 26 Aug 2005)
New Revision: 9629
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9629
Log:
Patched up and enabled mput command.
Minor fixes to put command.
-Kalim
Modified:
branches/SOC/SAMBA_3_0/source/client/client.c
Changeset:
Modified: branches/SOC/SAMBA_3_0/source/client/client.c
===================================================================
--- branches/SOC/SAMBA_3_0/source/client/client.c 2005-08-26 03:40:24 UTC (rev 9628)
+++ branches/SOC/SAMBA_3_0/source/client/client.c 2005-08-26 04:23:41 UTC (rev 9629)
@@ -961,7 +961,7 @@
}
if (nread + start < stat.st_size) {
- DEBUG (0, ("Short read when getting file %s. Only got %ld bytes.\n", rname, (long)nread));
+ DEBUG (1, ("Short read when getting file %s. Only got %ld bytes.\n", rname, (long)nread));
rc = 1;
}
@@ -1337,6 +1337,11 @@
start = stat.st_size;
} else {
fnum = smbc_creat(rname, 0644);
+ if (fnum < 0)
+ {
+ d_printf("%s trying to create remote file %s\n", strerror(errno), rname);
+ return 1;
+ }
}
/* allow files to be piped into smbclient
@@ -1658,17 +1663,25 @@
if (!seek_list(temp_list, lname))
break;
} else { /* Yes */
- SAFE_FREE(rname);
- if(asprintf(&rname, "%s%s", cur_dir, lname) < 0) break;
- dos_format(rname);
- if (!cli_chkpath(cli, rname) &&
- !do_mkdir(rname)) {
- DEBUG (0, ("Unable to make dir, skipping..."));
- /* Skip the directory */
- lname[strlen(lname)-1] = '/';
- if (!seek_list(temp_list, lname))
- break;
- }
+ int dh;
+ SAFE_FREE(rname);
+ if(asprintf(&rname, "smb:%s%s%s", service, cur_dir, lname) < 0) break;
+ /*dos_format(rname);*/
+
+ /* test if the directory exists by opening it */
+ if (!((dh=smbc_opendir(rname)) < 0)) {
+ smbc_closedir(dh);
+ continue;
+ }
+ /* directory does not exist, try making it */
+ if (!(smbc_mkdir(rname, 755) < 0))
+ continue;
+
+ d_printf("Unable to open or create dir, skipping...\n");
+ /* Skip the directory */
+ lname[strlen(lname)-1] = '/';
+ if (!seek_list(temp_list, lname))
+ break;
}
continue;
} else {
@@ -1679,11 +1692,10 @@
/* Yes */
SAFE_FREE(rname);
- if (asprintf(&rname, "%s%s", cur_dir, lname) < 0) break;
+ if (asprintf(&rname, "smb:%s%s%s", service, cur_dir, lname) < 0) break;
}
- dos_format(rname);
-
+ /*d_printf("PUT: rname: %s, lname: %s\n", rname, lname);*/
do_put(rname, lname, False);
}
free_file_list(file_list);
@@ -2906,7 +2918,7 @@
/* {"mget",cmd_mget,"<mask> get all the matching files",{COMPL_REMOTE,COMPL_NONE}}, */
{"mkdir",cmd_mkdir,"<directory> make a directory",{COMPL_NONE,COMPL_NONE}},
/* {"more",cmd_more,"<remote name> view a remote file with your pager",{COMPL_REMOTE,COMPL_NONE}}, */
-/* {"mput",cmd_mput,"<mask> put all matching files",{COMPL_REMOTE,COMPL_NONE}}, */
+ {"mput",cmd_mput,"<mask> put all matching files",{COMPL_REMOTE,COMPL_NONE}},
{"newer",cmd_newer,"<file> only mget files newer than the specified local file",{COMPL_LOCAL,COMPL_NONE}},
/* {"open",cmd_open,"<mask> open a file",{COMPL_REMOTE,COMPL_NONE}}, */
/* {"print",cmd_print,"<file name> print a file",{COMPL_NONE,COMPL_NONE}}, */
More information about the samba-cvs
mailing list