summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-11-11 15:51:46 +0100
committerVolker Lendecke <vlendec@samba.org>2010-11-11 16:16:24 +0000
commitddd33f035199bce2fc9d8deb3c2c4ad627ad36d4 (patch)
tree207c2886ab74c3ab72b564c05e599cd7834b8e08 /source3
parent1b13a4d22b3f0eca6926ab8ce61147784f6e993e (diff)
downloadsamba-ddd33f035199bce2fc9d8deb3c2c4ad627ad36d4.tar.gz
samba-ddd33f035199bce2fc9d8deb3c2c4ad627ad36d4.tar.bz2
samba-ddd33f035199bce2fc9d8deb3c2c4ad627ad36d4.zip
s3: Make cli_set_ea_path return NTSTATUS
Diffstat (limited to 'source3')
-rw-r--r--source3/client/client.c8
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/libsmb/clifile.c8
-rw-r--r--source3/torture/torture.c18
4 files changed, 25 insertions, 13 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 51292680ba..062809d1b6 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -3346,6 +3346,7 @@ static int cmd_setea(void)
char *eavalue = NULL;
char *targetname = NULL;
struct cli_state *targetcli;
+ NTSTATUS status;
if (!next_token_talloc(ctx, &cmd_ptr, &name, NULL)
|| !next_token_talloc(ctx, &cmd_ptr, &eaname, NULL)) {
@@ -3369,9 +3370,10 @@ static int cmd_setea(void)
return 1;
}
- if (!cli_set_ea_path(targetcli, targetname, eaname, eavalue,
- strlen(eavalue))) {
- d_printf("set_ea %s: %s\n", src, cli_errstr(cli));
+ status = cli_set_ea_path(targetcli, targetname, eaname, eavalue,
+ strlen(eavalue));
+ if (!NT_STATUS_IS_OK(status)) {
+ d_printf("set_ea %s: %s\n", src, nt_errstr(status));
return 1;
}
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 10468be312..69b59a1088 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2077,7 +2077,9 @@ NTSTATUS cli_ctemp(struct cli_state *cli,
uint16_t *pfnum,
char **out_path);
NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
-bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_name, const char *ea_val, size_t ea_len);
+NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
+ const char *ea_name, const char *ea_val,
+ size_t ea_len);
bool cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum, const char *ea_name, const char *ea_val, size_t ea_len);
struct tevent_req *cli_get_ea_list_path_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index f8a6220173..23f9567f85 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -4120,7 +4120,9 @@ static NTSTATUS cli_set_ea(struct cli_state *cli, uint16_t setup_val,
Set an extended attribute on a pathname.
*********************************************************/
-bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_name, const char *ea_val, size_t ea_len)
+NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
+ const char *ea_name, const char *ea_val,
+ size_t ea_len)
{
unsigned int param_len = 0;
uint8_t *param;
@@ -4130,7 +4132,7 @@ bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_nam
param = SMB_MALLOC_ARRAY(uint8_t, 6+srclen+2);
if (!param) {
- return false;
+ return NT_STATUS_NO_MEMORY;
}
memset(param, '\0', 6);
SSVAL(param,0,SMB_INFO_SET_EA);
@@ -4142,7 +4144,7 @@ bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_nam
status = cli_set_ea(cli, TRANSACT2_SETPATHINFO, param, param_len,
ea_name, ea_val, ea_len);
SAFE_FREE(param);
- return NT_STATUS_IS_OK(status);
+ return status;
}
/*********************************************************
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index f69d734b7b..635eb5d867 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -5222,8 +5222,10 @@ static bool run_eatest(int dummy)
slprintf(ea_name, sizeof(ea_name), "EA_%d", i+10);
memset(ea_val, (char)i+1, i+1);
- if (!cli_set_ea_path(cli, fname, ea_name, ea_val, i+1)) {
- printf("ea_set of name %s failed - %s\n", ea_name, cli_errstr(cli));
+ status = cli_set_ea_path(cli, fname, ea_name, ea_val, i+1);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("ea_set of name %s failed - %s\n", ea_name,
+ nt_errstr(status));
talloc_destroy(mem_ctx);
return False;
}
@@ -5257,8 +5259,10 @@ static bool run_eatest(int dummy)
for (i = 0; i < 20; i++) {
fstring ea_name;
slprintf(ea_name, sizeof(ea_name), "ea_%d", i);
- if (!cli_set_ea_path(cli, fname, ea_name, "", 0)) {
- printf("ea_set of name %s failed - %s\n", ea_name, cli_errstr(cli));
+ status = cli_set_ea_path(cli, fname, ea_name, "", 0);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("ea_set of name %s failed - %s\n", ea_name,
+ nt_errstr(status));
talloc_destroy(mem_ctx);
return False;
}
@@ -5284,8 +5288,10 @@ static bool run_eatest(int dummy)
}
/* Try and delete a non existant EA. */
- if (!cli_set_ea_path(cli, fname, "foo", "", 0)) {
- printf("deleting non-existant EA 'foo' should succeed. %s\n", cli_errstr(cli));
+ status = cli_set_ea_path(cli, fname, "foo", "", 0);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("deleting non-existant EA 'foo' should succeed. %s\n",
+ nt_errstr(status));
correct = False;
}