struct cli_state *cli;
extern BOOL in_client;
+static int port = SMB_PORT;
pstring cur_dir = "\\";
pstring cd_path = "";
static pstring service;
int put_total_time_ms = 0;
/* totals globals */
-int dir_total = 0;
+static double dir_total;
#define USENMB
if (do_list_fn == display_finfo) {
DEBUG(0,("\n%s\n",CNV_LANG(mask2)));
}
- pstrcat(mask2,"\\*.*");
+ pstrcat(mask2,"\\*");
do_list(mask2, do_list_attr, do_list_fn, True, True);
}
return;
pstrcat(mask,p);
}
else {
- pstrcat(mask,"*.*");
+ pstrcat(mask,"*");
}
do_list(mask, attribute, display_finfo, recurse, True);
do_dskattr();
- DEBUG(3, ("Total bytes listed: %d\n", dir_total));
+ DEBUG(3, ("Total bytes listed: %.0f\n", dir_total));
}
else
pstrcat(mask,p);
} else {
- pstrcat(mask,"*.*");
+ pstrcat(mask,"*");
}
do_list(mask, attribute, do_du, recurse, True);
do_dskattr();
- DEBUG(0, ("Total number of bytes: %d\n", dir_total));
+ DEBUG(0, ("Total number of bytes: %.0f\n", dir_total));
}
if(!strcmp(lname,"-")) {
handle = fileno(stdout);
} else {
- handle = open(lname,O_WRONLY|O_CREAT|O_TRUNC,0644);
+ handle = sys_open(lname,O_WRONLY|O_CREAT|O_TRUNC,0644);
newhandle = True;
}
if (handle < 0) {
}
- if (!cli_getattrE(cli, fnum, &attr, &size, NULL, NULL, NULL)) {
- DEBUG(0,("getattrE: %s\n",cli_errstr(cli)));
+ if (!cli_qfileinfo(cli, fnum,
+ &attr, &size, NULL, NULL, NULL, NULL, NULL) &&
+ !cli_getattrE(cli, fnum,
+ &attr, &size, NULL, NULL, NULL)) {
+ DEBUG(0,("getattrib: %s\n",cli_errstr(cli)));
return;
}
-
DEBUG(2,("getting file %s of size %.0f as %s ",
lname, (double)size, lname));
if (lowercase)
strlower(finfo->name);
- if (!directory_exist(finfo->name,NULL) &&
+ if (!dos_directory_exist(finfo->name,NULL) &&
dos_mkdir(finfo->name,0777) != 0) {
DEBUG(0,("failed to create directory %s\n",CNV_LANG(finfo->name)));
pstrcpy(cur_dir,saved_curdir);
}
pstrcpy(mget_mask,cur_dir);
- pstrcat(mget_mask,"*.*");
+ pstrcat(mget_mask,"*");
do_list(mget_mask, aSYSTEM | aHIDDEN | aDIR,do_mget,False, True);
chdir("..");
pstrcpy(mget_mask,cur_dir);
if(mget_mask[strlen(mget_mask)-1]!='\\')
pstrcat(mget_mask,"\\");
- pstrcat(mget_mask,"*.*");
+ pstrcat(mget_mask,"*");
do_list(mget_mask, attribute,do_mget,False,True);
}
}
f = stdin;
/* size of file is not known */
} else {
- f = fopen(lname,"r");
+ f = sys_fopen(lname,"r");
}
if (!f) {
"/bin/ls %s > %s",p,tmpname);
system(cmd);
- f = fopen(tmpname,"r");
+ f = sys_fopen(tmpname,"r");
if (!f) continue;
while (!feof(f)) {
pstring d;
if (next_token(NULL,buf,NULL,sizeof(buf)))
- dos_chdir(buf);
- DEBUG(2,("the local directory is now %s\n",GetWd(d)));
+ chdir(buf);
+ DEBUG(2,("the local directory is now %s\n",sys_getwd(d)));
}
/****************************************************************************
/*****************************************************
return a connection to a server
*******************************************************/
-struct cli_state *do_connect(char *server, char *share)
+struct cli_state *do_connect(char *server, char *share, int smb_port)
{
struct cli_state *c;
struct nmb_name called, calling;
ip = ipzero;
- strupper(server);
-
make_nmb_name(&calling, global_myname, 0x0, "");
make_nmb_name(&called , server, name_type, "");
+ if (smb_port == 0)
+ smb_port = 139; /* If not set, set to 139, FIXME, NUMBERS BAD */
+
again:
ip = ipzero;
if (have_ip) ip = dest_ip;
/* have to open a new connection */
- if (!(c=cli_initialise(NULL)) || !cli_connect(c, server_n, &ip)) {
+ if (!(c=cli_initialise(NULL)) || (cli_set_port(c, smb_port) == 0) ||
+ !cli_connect(c, server_n, &ip)) {
DEBUG(0,("Connection to %s failed\n", server_n));
return NULL;
}
****************************************************************************/
static BOOL process(char *base_directory)
{
- cli = do_connect(desthost, service);
-
+ cli = do_connect(desthost, service, port);
if (!cli) {
return(False);
}
sscanf(p, "%d", &fd);
close_it = False;
} else if ((p = getenv("PASSWD_FILE")) != NULL) {
- fd = open(p, O_RDONLY);
+ fd = sys_open(p, O_RDONLY, 0);
pstrcpy(spec, p);
if (fd < 0) {
fprintf(stderr, "Error opening PASSWD_FILE %s: %s\n",
/****************************************************************************
handle a -L query
****************************************************************************/
-static int do_host_query(char *query_host, int port)
+static int do_host_query(char *query_host, int smb_port)
{
- cli = do_connect(query_host, "IPC$");
- if (!cli) return 1;
+ cli = do_connect(query_host, "IPC$", smb_port);
+ if (!cli)
+ return 1;
browse_host(True);
list_servers(workgroup);
/****************************************************************************
handle a tar operation
****************************************************************************/
-static int do_tar_op(int port, char *base_directory)
+static int do_tar_op(int smb_port, char *base_directory)
{
int ret;
- cli = do_connect(desthost, service);
+ cli = do_connect(desthost, service, smb_port);
+ if (!cli)
+ return 1;
recurse=True;
ip = ipzero;
- strupper(desthost);
-
make_nmb_name(&calling, global_myname, 0x0, "");
make_nmb_name(&called , desthost, name_type, "");
{
fstring base_directory;
char *pname = argv[0];
- int port = SMB_PORT;
int opt;
extern FILE *dbf;
extern char *optarg;
case 'M':
name_type = 0x03; /* messages are sent to NetBIOS name type 0x3 */
pstrcpy(desthost,optarg);
- strupper(desthost);
message = True;
break;
case 'i':
}
break;
case 'L':
- got_pass = True;
pstrcpy(query_host,optarg);
if(!explicit_user)
*username = '\0';
}
get_myname((*global_myname)?NULL:global_myname,NULL);
- strupper(global_myname);
if(*new_name_resolve_order)
lp_set_name_resolve_order(new_name_resolve_order);