summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-08-13 16:04:21 +0000
committerAndrew Tridgell <tridge@samba.org>2003-08-13 16:04:21 +0000
commit75c0125fb71b0562e7bdd85c391764796b5f12f6 (patch)
treeb589d2e6bbc2c517a3f79790d0ed309ef79f7507 /source4/libcli
parenta3b86fe170beb70ffab8585a276ca1648fffd454 (diff)
downloadsamba-75c0125fb71b0562e7bdd85c391764796b5f12f6.tar.gz
samba-75c0125fb71b0562e7bdd85c391764796b5f12f6.tar.bz2
samba-75c0125fb71b0562e7bdd85c391764796b5f12f6.zip
- added SMBntrename test suite
- allow username of form DOMAIN\username or DOMAIN/username - added ntrename to gentest (This used to be commit 2b464472c17b791eb5b117f89d5aaea2bf60f6ad)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/cliconnect.c15
-rw-r--r--source4/libcli/clifile.c9
-rw-r--r--source4/libcli/namequery.c2
-rw-r--r--source4/libcli/raw/rawfile.c27
4 files changed, 39 insertions, 14 deletions
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index da8a842dae..03112176d4 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -146,13 +146,24 @@ NTSTATUS cli_full_connection(struct cli_state **ret_cli,
{
struct cli_tree *tree;
NTSTATUS status;
+ char *p;
+ TALLOC_CTX *mem_ctx;
+
+ mem_ctx = talloc_init("cli_full_connection");
*ret_cli = NULL;
+ /* if the username is of the form DOMAIN\username then split out the domain */
+ p = strpbrk(username, "\\/");
+ if (p) {
+ domain = talloc_strndup(mem_ctx, username, PTR_DIFF(p, username));
+ username = talloc_strdup(mem_ctx, p+1);
+ }
+
status = cli_tree_full_connection(&tree, myname, host, 0, sharename, devtype,
username, domain, password);
if (!NT_STATUS_IS_OK(status)) {
- return status;
+ goto done;
}
(*ret_cli) = cli_state_init();
@@ -162,6 +173,8 @@ NTSTATUS cli_full_connection(struct cli_state **ret_cli,
(*ret_cli)->transport = tree->session->transport;
tree->reference_count++;
+done:
+ talloc_destroy(mem_ctx);
return status;
}
diff --git a/source4/libcli/clifile.c b/source4/libcli/clifile.c
index c203e4633d..cd01d51017 100644
--- a/source4/libcli/clifile.c
+++ b/source4/libcli/clifile.c
@@ -137,11 +137,12 @@ BOOL cli_unix_chown(struct cli_state *cli, const char *fname, uid_t uid, gid_t g
****************************************************************************/
BOOL cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst)
{
- struct smb_rename parms;
+ union smb_rename parms;
- parms.in.attrib = FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY;
- parms.in.pattern1 = fname_src;
- parms.in.pattern2 = fname_dst;
+ parms.generic.level = RAW_RENAME_RENAME;
+ parms.rename.in.attrib = FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY;
+ parms.rename.in.pattern1 = fname_src;
+ parms.rename.in.pattern2 = fname_dst;
return NT_STATUS_IS_OK(smb_raw_rename(cli->tree, &parms));
}
diff --git a/source4/libcli/namequery.c b/source4/libcli/namequery.c
index 2f6343dcaf..a04e883138 100644
--- a/source4/libcli/namequery.c
+++ b/source4/libcli/namequery.c
@@ -801,7 +801,7 @@ static BOOL internal_resolve_name(TALLOC_CTX *mem_ctx, const char *name, int nam
}
} else if(strequal( tok, "lmhosts")) {
/* REWRITE: add back in? */
- DEBUG(0,("resolve_name: REWRITE: add lmhosts back?? %s\n", tok));
+ DEBUG(2,("resolve_name: REWRITE: add lmhosts back?? %s\n", tok));
} else if(strequal( tok, "wins")) {
/* don't resolve 1D via WINS */
if (name_type != 0x1D &&
diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c
index 279dfcf0c1..57b6ded66f 100644
--- a/source4/libcli/raw/rawfile.c
+++ b/source4/libcli/raw/rawfile.c
@@ -32,16 +32,27 @@
Rename a file - async interface
****************************************************************************/
struct cli_request *smb_raw_rename_send(struct cli_tree *tree,
- struct smb_rename *parms)
+ union smb_rename *parms)
{
struct cli_request *req;
- SETUP_REQUEST(SMBmv, 1, 0);
-
- SSVAL(req->out.vwv, VWV(0), parms->in.attrib);
-
- cli_req_append_ascii4(req, parms->in.pattern1, STR_TERMINATE);
- cli_req_append_ascii4(req, parms->in.pattern2, STR_TERMINATE);
+ switch (parms->generic.level) {
+ case RAW_RENAME_RENAME:
+ SETUP_REQUEST(SMBmv, 1, 0);
+ SSVAL(req->out.vwv, VWV(0), parms->rename.in.attrib);
+ cli_req_append_ascii4(req, parms->rename.in.pattern1, STR_TERMINATE);
+ cli_req_append_ascii4(req, parms->rename.in.pattern2, STR_TERMINATE);
+ break;
+
+ case RAW_RENAME_NTRENAME:
+ SETUP_REQUEST(SMBntrename, 4, 0);
+ SSVAL(req->out.vwv, VWV(0), parms->ntrename.in.attrib);
+ SSVAL(req->out.vwv, VWV(1), parms->ntrename.in.flags);
+ SIVAL(req->out.vwv, VWV(2), parms->ntrename.in.root_fid);
+ cli_req_append_ascii4(req, parms->ntrename.in.old_name, STR_TERMINATE);
+ cli_req_append_ascii4(req, parms->ntrename.in.new_name, STR_TERMINATE);
+ break;
+ }
if (!cli_request_send(req)) {
cli_request_destroy(req);
@@ -55,7 +66,7 @@ struct cli_request *smb_raw_rename_send(struct cli_tree *tree,
Rename a file - sync interface
****************************************************************************/
NTSTATUS smb_raw_rename(struct cli_tree *tree,
- struct smb_rename *parms)
+ union smb_rename *parms)
{
struct cli_request *req = smb_raw_rename_send(tree, parms);
return cli_request_simple_recv(req);