diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-03-16 15:20:28 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-04-14 14:19:39 +1000 |
commit | 872cb0257c64f8c8682968565c3dfa608167a95d (patch) | |
tree | 08d4334094102993de88067ed84434d5f40c555c /source3/libnet | |
parent | 927a8b330435b4c959ad851e32b83d97a6e3001b (diff) | |
download | samba-872cb0257c64f8c8682968565c3dfa608167a95d.tar.gz samba-872cb0257c64f8c8682968565c3dfa608167a95d.tar.bz2 samba-872cb0257c64f8c8682968565c3dfa608167a95d.zip |
Move DRSUAPI per-attribute decryption into a common file
This file (contining metze's decryption routines) is now also be used by
Samba3's DRSUAPI implementation
Andrew Bartlett
Diffstat (limited to 'source3/libnet')
-rw-r--r-- | source3/libnet/libnet_dssync.c | 76 |
1 files changed, 5 insertions, 71 deletions
diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 746b09635d..59feac2495 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -22,6 +22,7 @@ #include "includes.h" #include "libnet/libnet.h" +#include "../libcli/drsuapi/drsuapi.h" /**************************************************************** ****************************************************************/ @@ -61,49 +62,6 @@ NTSTATUS libnet_dssync_init_context(TALLOC_CTX *mem_ctx, /**************************************************************** ****************************************************************/ -static DATA_BLOB *decrypt_attr_val(TALLOC_CTX *mem_ctx, - DATA_BLOB *session_key, - uint32_t rid, - enum drsuapi_DsAttributeId id, - DATA_BLOB *raw_data) -{ - bool rcrypt = false; - DATA_BLOB out_data; - - ZERO_STRUCT(out_data); - - switch (id) { - case DRSUAPI_ATTRIBUTE_dBCSPwd: - case DRSUAPI_ATTRIBUTE_unicodePwd: - case DRSUAPI_ATTRIBUTE_ntPwdHistory: - case DRSUAPI_ATTRIBUTE_lmPwdHistory: - rcrypt = true; - break; - case DRSUAPI_ATTRIBUTE_supplementalCredentials: - case DRSUAPI_ATTRIBUTE_priorValue: - case DRSUAPI_ATTRIBUTE_currentValue: - case DRSUAPI_ATTRIBUTE_trustAuthOutgoing: - case DRSUAPI_ATTRIBUTE_trustAuthIncoming: - case DRSUAPI_ATTRIBUTE_initialAuthOutgoing: - case DRSUAPI_ATTRIBUTE_initialAuthIncoming: - break; - default: - return raw_data; - } - - out_data = decrypt_drsuapi_blob(mem_ctx, session_key, rcrypt, - rid, raw_data); - - if (out_data.length) { - return (DATA_BLOB *)talloc_memdup(mem_ctx, &out_data, sizeof(DATA_BLOB)); - } - - return raw_data; -} - -/**************************************************************** -****************************************************************/ - static void parse_obj_identifier(struct drsuapi_DsReplicaObjectIdentifier *id, uint32_t *rid) { @@ -121,30 +79,6 @@ static void parse_obj_identifier(struct drsuapi_DsReplicaObjectIdentifier *id, /**************************************************************** ****************************************************************/ -static void parse_obj_attribute(TALLOC_CTX *mem_ctx, - DATA_BLOB *session_key, - uint32_t rid, - struct drsuapi_DsReplicaAttribute *attr) -{ - int i = 0; - - for (i=0; i<attr->value_ctr.num_values; i++) { - - DATA_BLOB *plain_data = NULL; - - plain_data = decrypt_attr_val(mem_ctx, - session_key, - rid, - attr->attid, - attr->value_ctr.values[i].blob); - - attr->value_ctr.values[i].blob = plain_data; - } -} - -/**************************************************************** -****************************************************************/ - static void libnet_dssync_decrypt_attributes(TALLOC_CTX *mem_ctx, DATA_BLOB *session_key, struct drsuapi_DsReplicaObjectListItemEx *cur) @@ -170,10 +104,10 @@ static void libnet_dssync_decrypt_attributes(TALLOC_CTX *mem_ctx, continue; } - parse_obj_attribute(mem_ctx, - session_key, - rid, - attr); + drsuapi_decrypt_attribute(mem_ctx, + session_key, + rid, + attr); } } } |