diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-04-28 08:37:36 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:51:41 -0500 |
commit | 5b1a01a9c09d5ff68ae78f77b5f69d1c3aa6ab5c (patch) | |
tree | e8cfab224f158da6641e694bdd11c3f47099451c | |
parent | 9a66e0f7fb2342b00ba36f3ae272e94d8325a335 (diff) | |
download | samba-5b1a01a9c09d5ff68ae78f77b5f69d1c3aa6ab5c.tar.gz samba-5b1a01a9c09d5ff68ae78f77b5f69d1c3aa6ab5c.tar.bz2 samba-5b1a01a9c09d5ff68ae78f77b5f69d1c3aa6ab5c.zip |
r22546: use the same error codes in both share backends
metze
(This used to be commit e0fae01e4cf93393b57514ffc08c126abf034e11)
-rw-r--r-- | source4/param/share_ldb.c | 17 | ||||
-rw-r--r-- | source4/torture/local/share.c | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/source4/param/share_ldb.c b/source4/param/share_ldb.c index 2d865588a9..97a88e8f77 100644 --- a/source4/param/share_ldb.c +++ b/source4/param/share_ldb.c @@ -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; } diff --git a/source4/torture/local/share.c b/source4/torture/local/share.c index 69e9340ff7..487085b6dc 100644 --- a/source4/torture/local/share.c +++ b/source4/torture/local/share.c @@ -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"); |