summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2017-09-13 09:32:36 -0700
committerVolker Lendecke <vl@samba.org>2017-09-25 09:43:12 +0200
commitc0e28638fa839958d3e621be53243c2c513f94b4 (patch)
tree03a40ed44fa5e8998d2e45e076a459f7b4e7fa85 /libcli
parent62e655568ed13f587e98cb08563f515f2a9be570 (diff)
downloadsamba-c0e28638fa839958d3e621be53243c2c513f94b4.tar.gz
netlogon_creds_cli: Factor out netlogon_creds_cli_store_internal
In a future commit we'll need a version that does not check for context->db.locked_state Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'libcli')
-rw-r--r--libcli/auth/netlogon_creds_cli.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/libcli/auth/netlogon_creds_cli.c b/libcli/auth/netlogon_creds_cli.c
index 178d9c88b92..f1aa8d03ca5 100644
--- a/libcli/auth/netlogon_creds_cli.c
+++ b/libcli/auth/netlogon_creds_cli.c
@@ -578,28 +578,15 @@ bool netlogon_creds_cli_validate(struct netlogon_creds_cli_context *context,
return (cmp == 0);
}
-NTSTATUS netlogon_creds_cli_store(struct netlogon_creds_cli_context *context,
- struct netlogon_creds_CredentialState *creds)
+static NTSTATUS netlogon_creds_cli_store_internal(
+ struct netlogon_creds_cli_context *context,
+ struct netlogon_creds_CredentialState *creds)
{
NTSTATUS status;
enum ndr_err_code ndr_err;
DATA_BLOB blob;
TDB_DATA data;
- if (context->db.locked_state == NULL) {
- /*
- * this was not the result of netlogon_creds_cli_lock*()
- */
- return NT_STATUS_INVALID_PAGE_PROTECTION;
- }
-
- if (context->db.locked_state->creds != creds) {
- /*
- * this was not the result of netlogon_creds_cli_lock*()
- */
- return NT_STATUS_INVALID_PAGE_PROTECTION;
- }
-
if (DEBUGLEVEL >= 10) {
NDR_PRINT_DEBUG(netlogon_creds_CredentialState, creds);
}
@@ -625,6 +612,29 @@ NTSTATUS netlogon_creds_cli_store(struct netlogon_creds_cli_context *context,
return NT_STATUS_OK;
}
+NTSTATUS netlogon_creds_cli_store(struct netlogon_creds_cli_context *context,
+ struct netlogon_creds_CredentialState *creds)
+{
+ NTSTATUS status;
+
+ if (context->db.locked_state == NULL) {
+ /*
+ * this was not the result of netlogon_creds_cli_lock*()
+ */
+ return NT_STATUS_INVALID_PAGE_PROTECTION;
+ }
+
+ if (context->db.locked_state->creds != creds) {
+ /*
+ * this was not the result of netlogon_creds_cli_lock*()
+ */
+ return NT_STATUS_INVALID_PAGE_PROTECTION;
+ }
+
+ status = netlogon_creds_cli_store_internal(context, creds);
+ return status;
+}
+
NTSTATUS netlogon_creds_cli_delete(struct netlogon_creds_cli_context *context,
struct netlogon_creds_CredentialState *creds)
{