mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
r22546: use the same error codes in both share backends
metze (This used to be commit e0fae01e4cf93393b57514ffc08c126abf034e11)
This commit is contained in:
parent
9a66e0f7fb
commit
5b1a01a9c0
@ -175,7 +175,7 @@ static NTSTATUS sldb_list_all(TALLOC_CTX *mem_ctx,
|
||||
talloc_steal(tmp_ctx, res);
|
||||
if (ret != LDB_SUCCESS) {
|
||||
talloc_free(tmp_ctx);
|
||||
return NT_STATUS_BAD_NETWORK_NAME;
|
||||
return NT_STATUS_INTERNAL_DB_CORRUPTION;
|
||||
}
|
||||
|
||||
n = talloc_array(mem_ctx, const char *, res->count);
|
||||
@ -223,9 +223,12 @@ static NTSTATUS sldb_get_config(TALLOC_CTX *mem_ctx,
|
||||
ret = ldb_search_exp_fmt(ldb, tmp_ctx, &res,
|
||||
ldb_dn_new(tmp_ctx, ldb, "CN=SHARES"), LDB_SCOPE_SUBTREE, NULL,
|
||||
"(name=%s)", name);
|
||||
if (ret != LDB_SUCCESS || res->count != 1) {
|
||||
if (ret != LDB_SUCCESS || res->count > 1) {
|
||||
talloc_free(tmp_ctx);
|
||||
return NT_STATUS_BAD_NETWORK_NAME;
|
||||
return NT_STATUS_INTERNAL_DB_CORRUPTION;
|
||||
} else if (res->count != 1) {
|
||||
talloc_free(tmp_ctx);
|
||||
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
|
||||
s = talloc(tmp_ctx, struct share_config);
|
||||
@ -363,7 +366,9 @@ NTSTATUS sldb_create(struct share_context *ctx, const char *name, struct share_i
|
||||
DEBUG(2,("ERROR: unable to add share %s to share.ldb\n"
|
||||
" err=%d [%s]\n", name, err, ldb_errstring(ldb)));
|
||||
if (err == LDB_ERR_NO_SUCH_OBJECT) {
|
||||
ret = NT_STATUS_BAD_NETWORK_NAME;
|
||||
ret = NT_STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
} else if (err == LDB_ERR_ENTRY_ALREADY_EXISTS) {
|
||||
ret = NT_STATUS_OBJECT_NAME_COLLISION;
|
||||
} else {
|
||||
ret = NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
@ -499,7 +504,7 @@ NTSTATUS sldb_set(struct share_context *ctx, const char *name, struct share_info
|
||||
DEBUG(2,("ERROR: unable to rename share %s (to %s)\n"
|
||||
" err=%d [%s]\n", name, newname, err, ldb_errstring(ldb)));
|
||||
if (err == LDB_ERR_NO_SUCH_OBJECT) {
|
||||
ret = NT_STATUS_BAD_NETWORK_NAME;
|
||||
ret = NT_STATUS_OBJECT_NAME_COLLISION;
|
||||
} else {
|
||||
ret = NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
@ -514,7 +519,7 @@ NTSTATUS sldb_set(struct share_context *ctx, const char *name, struct share_info
|
||||
DEBUG(2,("ERROR: unable to add share %s to share.ldb\n"
|
||||
" err=%d [%s]\n", name, err, ldb_errstring(ldb)));
|
||||
if (err == LDB_ERR_NO_SUCH_OBJECT) {
|
||||
ret = NT_STATUS_BAD_NETWORK_NAME;
|
||||
ret = NT_STATUS_OBJECT_NAME_COLLISION;
|
||||
} else {
|
||||
ret = NT_STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ static bool test_double_create(struct torture_context *tctx,
|
||||
|
||||
torture_assert_ntstatus_ok(tctx, status, "create_share failed");
|
||||
|
||||
torture_assert_ntstatus_equal(tctx, NT_STATUS_UNSUCCESSFUL,
|
||||
torture_assert_ntstatus_equal(tctx, NT_STATUS_OBJECT_NAME_COLLISION,
|
||||
share_create(ctx, "bla", inf, 2),
|
||||
"create_share failed");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user