static pstring cd_path = "";
static pstring service;
static pstring desthost;
-static pstring username;
-static pstring domain;
-static pstring password;
static char *cmdstr = NULL;
static int io_bufsize = 64512;
#define USENMB
/* some forward declarations */
-static struct smbcli_state *do_connect(const char *server, const char *share);
+static struct smbcli_state *do_connect(const char *server, const char *share, struct cli_credentials *cred);
/*******************************************************************
int total_len = 0;
int grp_id;
- if (!smbcli_message_start(cli->tree, desthost, username, &grp_id)) {
+ if (!smbcli_message_start(cli->tree, desthost, cli_credentials_get_username(cmdline_credentials), &grp_id)) {
d_printf("message start: %s\n", smbcli_errstr(cli->tree));
return;
}
int l=0;
int c;
- ZERO_ARRAY(msg);
+ ZERO_STRUCT(msg);
for (l=0;l<maxlen && (c=fgetc(stdin))!=EOF;l++) {
if (c == '\n')
strlower(discard_const_p(char, finfo->name));
}
- if (!directory_exist(finfo->name,NULL) &&
+ if (!directory_exist(finfo->name) &&
mkdir(finfo->name,0777) != 0) {
d_printf("failed to create directory %s\n",finfo->name);
pstrcpy(cur_dir,saved_curdir);
dos_clean_name(rname);
- {
- struct stat st;
- /* allow '-' to represent stdin
- jdblair, 24.jun.98 */
- if (!file_exist(lname,&st) &&
- (strcmp(lname,"-"))) {
- d_printf("%s does not exist\n",lname);
- return 1;
- }
+ /* allow '-' to represent stdin
+ jdblair, 24.jun.98 */
+ if (!file_exist(lname) && (strcmp(lname,"-"))) {
+ d_printf("%s does not exist\n",lname);
+ return 1;
}
return do_put(rname, lname, False);
pstring remote_name;
fstring buf;
char *p = buf;
- struct stat st;
pstrcpy(remote_name, cur_dir);
pstrcat(remote_name, "\\");
}
pstrcpy(local_name, p);
- if (!file_exist(local_name, &st)) {
+ if (!file_exist(local_name)) {
d_printf("%s does not exist\n", local_name);
return 1;
}
status = dcerpc_pipe_connect(&p, binding,
DCERPC_SRVSVC_UUID,
DCERPC_SRVSVC_VERSION,
- domain,
- username, password);
+ lp_netbios_name(),
+ cli_credentials_get_domain(cmdline_credentials),
+ cli_credentials_get_username(cmdline_credentials),
+ cli_credentials_get_password(cmdline_credentials));
if (!NT_STATUS_IS_OK(status)) {
d_printf("Failed to connect to %s - %s\n",
binding, nt_errstr(status));
/* establish the connection if not already */
if (!cli) {
- cli = do_connect(desthost, service);
+ cli = do_connect(desthost, service, cmdline_credentials);
if (!cli)
return 0;
}
/*****************************************************
return a connection to a server
*******************************************************/
-static struct smbcli_state *do_connect(const char *server, const char *share)
+static struct smbcli_state *do_connect(const char *server, const char *share, struct cli_credentials *cred)
{
struct smbcli_state *c;
NTSTATUS status;
}
status = smbcli_full_connection(NULL, &c, lp_netbios_name(), server,
- share, NULL, username, domain, password);
+ share, NULL, cli_credentials_get_username(cred),
+ cli_credentials_get_domain(cred),
+ cli_credentials_get_password(cred));
if (!NT_STATUS_IS_OK(status)) {
d_printf("Connection to \\\\%s\\%s failed - %s\n",
server, share, nt_errstr(status));
{
int rc = 0;
- cli = do_connect(desthost, service);
+ cli = do_connect(desthost, service, cmdline_credentials);
if (!cli) {
return 1;
}
}
if (poptPeekArg(pc)) {
- cmdline_set_userpassword(poptGetArg(pc));
+ cli_credentials_set_password(cmdline_credentials, poptGetArg(pc), CRED_SPECIFIED);
}
/*init_names(); */
poptFreeContext(pc);
- pstrcpy(username, cmdline_get_username());
- pstrcpy(domain, cmdline_get_userdomain());
- pstrcpy(password, cmdline_get_userpassword());
-
DEBUG( 3, ( "Client started (version %s).\n", SAMBA_VERSION_STRING ) );
talloc_free(mem_ctx);