[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-test-2054-g5e60852
Günther Deschner
gd at samba.org
Sat Feb 9 01:07:22 GMT 2008
The branch, v3-2-test has been updated
via 5e60852bae61be72dee9d5b93c59ac900aba73ae (commit)
via 31132f33e2c7ee9664e3094eec1b5be45a69c6b2 (commit)
via 2d5e2abc2715acaddd2d05c9d0b634a3595143f1 (commit)
via ac1e4f1eb2c046def4fa30ab0bd98c49add8e8c8 (commit)
from 33a9859cbdb0dac035af36aa561b6acb24196c86 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit 5e60852bae61be72dee9d5b93c59ac900aba73ae
Author: Günther Deschner <gd at samba.org>
Date: Fri Feb 8 23:12:53 2008 +0100
More paranoid checks for secrets_init() success.
Guenther
commit 31132f33e2c7ee9664e3094eec1b5be45a69c6b2
Author: Günther Deschner <gd at samba.org>
Date: Sat Feb 9 02:00:25 2008 +0100
Remove unused marshalling for SAMR_ENUM_DOMAINS.
Guenther
commit 2d5e2abc2715acaddd2d05c9d0b634a3595143f1
Author: Günther Deschner <gd at samba.org>
Date: Sat Feb 9 01:55:49 2008 +0100
Use pidl for _samr_EnumDomains().
Guenther
commit ac1e4f1eb2c046def4fa30ab0bd98c49add8e8c8
Author: Günther Deschner <gd at samba.org>
Date: Sat Feb 9 01:33:47 2008 +0100
Testing revealed some errors, reverting some of the lsa changes.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source/include/rpc_samr.h | 31 ---------
source/librpc/gen_ndr/cli_lsa.c | 6 +-
source/librpc/gen_ndr/cli_lsa.h | 6 +-
source/librpc/gen_ndr/lsa.h | 8 +-
source/librpc/gen_ndr/ndr_lsa.c | 106 ++++--------------------------
source/librpc/gen_ndr/srv_lsa.c | 4 +-
source/librpc/idl/lsa.idl | 8 +-
source/passdb/secrets.c | 48 ++++++++++----
source/rpc_parse/parse_samr.c | 139 ---------------------------------------
source/rpc_server/srv_lsa_nt.c | 4 +-
source/rpc_server/srv_samr.c | 22 +------
source/rpc_server/srv_samr_nt.c | 98 ++++++++++------------------
source/rpcclient/cmd_lsarpc.c | 6 +-
13 files changed, 103 insertions(+), 383 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/include/rpc_samr.h b/source/include/rpc_samr.h
index 7321495..16e9689 100644
--- a/source/include/rpc_samr.h
+++ b/source/include/rpc_samr.h
@@ -457,37 +457,6 @@ typedef struct samr_entry_info
} SAM_ENTRY;
-
-/* SAMR_Q_ENUM_DOMAINS - SAM rids and names */
-typedef struct q_samr_enum_domains_info
-{
- POLICY_HND pol; /* policy handle */
-
- uint32 start_idx; /* enumeration handle */
- uint32 max_size; /* 0x0000 ffff */
-
-} SAMR_Q_ENUM_DOMAINS;
-
-/* SAMR_R_ENUM_DOMAINS - SAM rids and Domain names */
-typedef struct r_samr_enum_domains_info
-{
- uint32 next_idx; /* next starting index required for enum */
- uint32 ptr_entries1;
-
- uint32 num_entries2;
- uint32 ptr_entries2;
-
- uint32 num_entries3;
-
- SAM_ENTRY *sam;
- UNISTR2 *uni_dom_name;
-
- uint32 num_entries4;
-
- NTSTATUS status;
-
-} SAMR_R_ENUM_DOMAINS;
-
/* SAMR_Q_ENUM_DOM_USERS - SAM rids and names */
typedef struct q_samr_enum_dom_users_info
{
diff --git a/source/librpc/gen_ndr/cli_lsa.c b/source/librpc/gen_ndr/cli_lsa.c
index 64da84d..ddd0c78 100644
--- a/source/librpc/gen_ndr/cli_lsa.c
+++ b/source/librpc/gen_ndr/cli_lsa.c
@@ -427,7 +427,7 @@ NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli,
struct policy_handle *handle,
struct dom_sid2 *sid,
uint32_t access_mask,
- struct policy_handle **acct_handle)
+ struct policy_handle *acct_handle)
{
struct lsa_CreateAccount r;
NTSTATUS status;
@@ -762,7 +762,7 @@ NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli,
struct policy_handle *handle,
struct dom_sid2 *sid,
uint32_t access_mask,
- struct policy_handle **acct_handle)
+ struct policy_handle *acct_handle)
{
struct lsa_OpenAccount r;
NTSTATUS status;
@@ -1499,7 +1499,7 @@ NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli,
NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
- struct policy_handle **handle)
+ struct policy_handle *handle)
{
struct lsa_DeleteObject r;
NTSTATUS status;
diff --git a/source/librpc/gen_ndr/cli_lsa.h b/source/librpc/gen_ndr/cli_lsa.h
index 396deba..3f64bb4 100644
--- a/source/librpc/gen_ndr/cli_lsa.h
+++ b/source/librpc/gen_ndr/cli_lsa.h
@@ -48,7 +48,7 @@ NTSTATUS rpccli_lsa_CreateAccount(struct rpc_pipe_client *cli,
struct policy_handle *handle,
struct dom_sid2 *sid,
uint32_t access_mask,
- struct policy_handle **acct_handle);
+ struct policy_handle *acct_handle);
NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle,
@@ -95,7 +95,7 @@ NTSTATUS rpccli_lsa_OpenAccount(struct rpc_pipe_client *cli,
struct policy_handle *handle,
struct dom_sid2 *sid,
uint32_t access_mask,
- struct policy_handle **acct_handle);
+ struct policy_handle *acct_handle);
NTSTATUS rpccli_lsa_EnumPrivsAccount(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle,
@@ -171,7 +171,7 @@ NTSTATUS rpccli_lsa_LookupPrivDisplayName(struct rpc_pipe_client *cli,
uint16_t unknown);
NTSTATUS rpccli_lsa_DeleteObject(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
- struct policy_handle **handle);
+ struct policy_handle *handle);
NTSTATUS rpccli_lsa_EnumAccountsWithUserRight(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle,
diff --git a/source/librpc/gen_ndr/lsa.h b/source/librpc/gen_ndr/lsa.h
index 06f714a..0df0dde 100644
--- a/source/librpc/gen_ndr/lsa.h
+++ b/source/librpc/gen_ndr/lsa.h
@@ -713,7 +713,7 @@ struct lsa_CreateAccount {
} in;
struct {
- struct policy_handle **acct_handle;/* [ref] */
+ struct policy_handle *acct_handle;/* [ref] */
NTSTATUS result;
} out;
@@ -829,7 +829,7 @@ struct lsa_OpenAccount {
} in;
struct {
- struct policy_handle **acct_handle;/* [ref] */
+ struct policy_handle *acct_handle;/* [ref] */
NTSTATUS result;
} out;
@@ -1051,11 +1051,11 @@ struct lsa_LookupPrivDisplayName {
struct lsa_DeleteObject {
struct {
- struct policy_handle **handle;/* [ref] */
+ struct policy_handle *handle;/* [ref] */
} in;
struct {
- struct policy_handle **handle;/* [ref] */
+ struct policy_handle *handle;/* [ref] */
NTSTATUS result;
} out;
diff --git a/source/librpc/gen_ndr/ndr_lsa.c b/source/librpc/gen_ndr/ndr_lsa.c
index 5ac4cbc..a3565c8 100644
--- a/source/librpc/gen_ndr/ndr_lsa.c
+++ b/source/librpc/gen_ndr/ndr_lsa.c
@@ -5321,10 +5321,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int
if (r->out.acct_handle == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
- NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.acct_handle));
- if (*r->out.acct_handle) {
- NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.acct_handle));
- }
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle));
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -5332,11 +5329,9 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int
_PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int flags, struct lsa_CreateAccount *r)
{
- uint32_t _ptr_acct_handle;
TALLOC_CTX *_mem_save_handle_0;
TALLOC_CTX *_mem_save_sid_0;
TALLOC_CTX *_mem_save_acct_handle_0;
- TALLOC_CTX *_mem_save_acct_handle_1;
if (flags & NDR_IN) {
ZERO_STRUCT(r->out);
@@ -5364,18 +5359,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int
}
_mem_save_acct_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.acct_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_acct_handle));
- if (_ptr_acct_handle) {
- NDR_PULL_ALLOC(ndr, *r->out.acct_handle);
- } else {
- *r->out.acct_handle = NULL;
- }
- if (*r->out.acct_handle) {
- _mem_save_acct_handle_1 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, *r->out.acct_handle, 0);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.acct_handle));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_1, 0);
- }
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
}
@@ -5408,12 +5392,7 @@ _PUBLIC_ void ndr_print_lsa_CreateAccount(struct ndr_print *ndr, const char *nam
ndr->depth++;
ndr_print_ptr(ndr, "acct_handle", r->out.acct_handle);
ndr->depth++;
- ndr_print_ptr(ndr, "acct_handle", *r->out.acct_handle);
- ndr->depth++;
- if (*r->out.acct_handle) {
- ndr_print_policy_handle(ndr, "acct_handle", *r->out.acct_handle);
- }
- ndr->depth--;
+ ndr_print_policy_handle(ndr, "acct_handle", r->out.acct_handle);
ndr->depth--;
ndr_print_NTSTATUS(ndr, "result", r->out.result);
ndr->depth--;
@@ -6208,10 +6187,7 @@ static enum ndr_err_code ndr_push_lsa_OpenAccount(struct ndr_push *ndr, int flag
if (r->out.acct_handle == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
- NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.acct_handle));
- if (*r->out.acct_handle) {
- NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.acct_handle));
- }
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle));
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -6219,11 +6195,9 @@ static enum ndr_err_code ndr_push_lsa_OpenAccount(struct ndr_push *ndr, int flag
static enum ndr_err_code ndr_pull_lsa_OpenAccount(struct ndr_pull *ndr, int flags, struct lsa_OpenAccount *r)
{
- uint32_t _ptr_acct_handle;
TALLOC_CTX *_mem_save_handle_0;
TALLOC_CTX *_mem_save_sid_0;
TALLOC_CTX *_mem_save_acct_handle_0;
- TALLOC_CTX *_mem_save_acct_handle_1;
if (flags & NDR_IN) {
ZERO_STRUCT(r->out);
@@ -6251,18 +6225,7 @@ static enum ndr_err_code ndr_pull_lsa_OpenAccount(struct ndr_pull *ndr, int flag
}
_mem_save_acct_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.acct_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_acct_handle));
- if (_ptr_acct_handle) {
- NDR_PULL_ALLOC(ndr, *r->out.acct_handle);
- } else {
- *r->out.acct_handle = NULL;
- }
- if (*r->out.acct_handle) {
- _mem_save_acct_handle_1 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, *r->out.acct_handle, 0);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.acct_handle));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_1, 0);
- }
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
}
@@ -6295,12 +6258,7 @@ _PUBLIC_ void ndr_print_lsa_OpenAccount(struct ndr_print *ndr, const char *name,
ndr->depth++;
ndr_print_ptr(ndr, "acct_handle", r->out.acct_handle);
ndr->depth++;
- ndr_print_ptr(ndr, "acct_handle", *r->out.acct_handle);
- ndr->depth++;
- if (*r->out.acct_handle) {
- ndr_print_policy_handle(ndr, "acct_handle", *r->out.acct_handle);
- }
- ndr->depth--;
+ ndr_print_policy_handle(ndr, "acct_handle", r->out.acct_handle);
ndr->depth--;
ndr_print_NTSTATUS(ndr, "result", r->out.result);
ndr->depth--;
@@ -7757,19 +7715,13 @@ static enum ndr_err_code ndr_push_lsa_DeleteObject(struct ndr_push *ndr, int fla
if (r->in.handle == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
- NDR_CHECK(ndr_push_unique_ptr(ndr, *r->in.handle));
- if (*r->in.handle) {
- NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.handle));
- }
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
}
if (flags & NDR_OUT) {
if (r->out.handle == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
- NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.handle));
- if (*r->out.handle) {
- NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.handle));
- }
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -7777,9 +7729,7 @@ static enum ndr_err_code ndr_push_lsa_DeleteObject(struct ndr_push *ndr, int fla
static enum ndr_err_code ndr_pull_lsa_DeleteObject(struct ndr_pull *ndr, int flags, struct lsa_DeleteObject *r)
{
- uint32_t _ptr_handle;
TALLOC_CTX *_mem_save_handle_0;
- TALLOC_CTX *_mem_save_handle_1;
if (flags & NDR_IN) {
ZERO_STRUCT(r->out);
@@ -7788,18 +7738,7 @@ static enum ndr_err_code ndr_pull_lsa_DeleteObject(struct ndr_pull *ndr, int fla
}
_mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_handle));
- if (_ptr_handle) {
- NDR_PULL_ALLOC(ndr, *r->in.handle);
- } else {
- *r->in.handle = NULL;
- }
- if (*r->in.handle) {
- _mem_save_handle_1 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, *r->in.handle, 0);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.handle));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_1, 0);
- }
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_PULL_ALLOC(ndr, r->out.handle);
*r->out.handle = *r->in.handle;
@@ -7810,18 +7749,7 @@ static enum ndr_err_code ndr_pull_lsa_DeleteObject(struct ndr_pull *ndr, int fla
}
_mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_handle));
- if (_ptr_handle) {
- NDR_PULL_ALLOC(ndr, *r->out.handle);
- } else {
- *r->out.handle = NULL;
- }
- if (*r->out.handle) {
- _mem_save_handle_1 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, *r->out.handle, 0);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.handle));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_1, 0);
- }
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
}
@@ -7840,12 +7768,7 @@ _PUBLIC_ void ndr_print_lsa_DeleteObject(struct ndr_print *ndr, const char *name
ndr->depth++;
ndr_print_ptr(ndr, "handle", r->in.handle);
ndr->depth++;
- ndr_print_ptr(ndr, "handle", *r->in.handle);
- ndr->depth++;
- if (*r->in.handle) {
- ndr_print_policy_handle(ndr, "handle", *r->in.handle);
- }
- ndr->depth--;
+ ndr_print_policy_handle(ndr, "handle", r->in.handle);
ndr->depth--;
ndr->depth--;
}
@@ -7854,12 +7777,7 @@ _PUBLIC_ void ndr_print_lsa_DeleteObject(struct ndr_print *ndr, const char *name
ndr->depth++;
ndr_print_ptr(ndr, "handle", r->out.handle);
ndr->depth++;
- ndr_print_ptr(ndr, "handle", *r->out.handle);
- ndr->depth++;
- if (*r->out.handle) {
- ndr_print_policy_handle(ndr, "handle", *r->out.handle);
- }
- ndr->depth--;
+ ndr_print_policy_handle(ndr, "handle", r->out.handle);
ndr->depth--;
ndr_print_NTSTATUS(ndr, "result", r->out.result);
ndr->depth--;
diff --git a/source/librpc/gen_ndr/srv_lsa.c b/source/librpc/gen_ndr/srv_lsa.c
index 874cf4c..d02bdb7 100644
--- a/source/librpc/gen_ndr/srv_lsa.c
+++ b/source/librpc/gen_ndr/srv_lsa.c
@@ -806,7 +806,7 @@ static bool api_lsa_CreateAccount(pipes_struct *p)
}
ZERO_STRUCT(r->out);
- r->out.acct_handle = talloc_zero(r, struct policy_handle *);
+ r->out.acct_handle = talloc_zero(r, struct policy_handle);
if (r->out.acct_handle == NULL) {
talloc_free(r);
return false;
@@ -1372,7 +1372,7 @@ static bool api_lsa_OpenAccount(pipes_struct *p)
}
ZERO_STRUCT(r->out);
- r->out.acct_handle = talloc_zero(r, struct policy_handle *);
+ r->out.acct_handle = talloc_zero(r, struct policy_handle);
if (r->out.acct_handle == NULL) {
talloc_free(r);
return false;
diff --git a/source/librpc/idl/lsa.idl b/source/librpc/idl/lsa.idl
index df1da31..516b435 100644
--- a/source/librpc/idl/lsa.idl
+++ b/source/librpc/idl/lsa.idl
@@ -278,7 +278,7 @@ import "security.idl";
[in] policy_handle *handle,
[in,ref] dom_sid2 *sid,
[in] uint32 access_mask,
- [out] policy_handle **acct_handle
+ [out] policy_handle *acct_handle
);
/******************/
@@ -429,11 +429,11 @@ import "security.idl";
/*****************************************/
/* Function: 0x11 */
- NTSTATUS lsa_OpenAccount (
+ NTSTATUS lsa_OpenAccount(
[in] policy_handle *handle,
[in,ref] dom_sid2 *sid,
[in] uint32 access_mask,
- [out] policy_handle **acct_handle
+ [out] policy_handle *acct_handle
);
@@ -664,7 +664,7 @@ import "security.idl";
/* Function: 0x22 */
NTSTATUS lsa_DeleteObject(
- [in,out] policy_handle **handle
+ [in,out] policy_handle *handle
);
/*******************/
diff --git a/source/passdb/secrets.c b/source/passdb/secrets.c
index 330ffbc..6c5375e 100644
--- a/source/passdb/secrets.c
+++ b/source/passdb/secrets.c
@@ -113,12 +113,20 @@ void secrets_shutdown(void)
void *secrets_fetch(const char *key, size_t *size)
{
TDB_DATA dbuf;
- secrets_init();
- if (!tdb)
+
+ if (!secrets_init()) {
return NULL;
+ }
+
+ if (!tdb) {
+ return NULL;
+ }
+
dbuf = tdb_fetch(tdb, string_tdb_data(key));
- if (size)
+ if (size) {
*size = dbuf.dsize;
+ }
+
return dbuf.dptr;
}
@@ -126,9 +134,14 @@ void *secrets_fetch(const char *key, size_t *size)
*/
bool secrets_store(const char *key, const void *data, size_t size)
{
- secrets_init();
- if (!tdb)
- return False;
+ if (!secrets_init()) {
+ return false;
+ }
+
+ if (!tdb) {
+ return false;
+ }
+
return tdb_trans_store(tdb, string_tdb_data(key),
make_tdb_data((const uint8 *)data, size),
TDB_REPLACE) == 0;
@@ -139,9 +152,14 @@ bool secrets_store(const char *key, const void *data, size_t size)
*/
bool secrets_delete(const char *key)
{
- secrets_init();
- if (!tdb)
- return False;
+ if (!secrets_init()) {
+ return false;
+ }
+
+ if (!tdb) {
+ return false;
+ }
+
return tdb_trans_delete(tdb, string_tdb_data(key)) == 0;
}
@@ -923,7 +941,9 @@ NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains,
return NT_STATUS_NO_MEMORY;
}
- if (!secrets_init()) return NT_STATUS_ACCESS_DENIED;
+ if (!secrets_init()) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
/* generate searching pattern */
pattern = talloc_asprintf(tmp_ctx, "%s/*", SECRETS_DOMTRUST_ACCT_PASS);
@@ -1034,12 +1054,14 @@ bool secrets_named_mutex(const char *name, unsigned int timeout)
{
int ret = 0;
- if (!secrets_init())
- return False;
+ if (!secrets_init()) {
--
Samba Shared Repository
More information about the samba-cvs
mailing list