1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

Store a local schannel key in secrets.tdb

This commit is contained in:
Volker Lendecke 2008-09-22 19:23:21 +02:00
parent bb4e9d72dd
commit f3ba7fc0b9
3 changed files with 29 additions and 0 deletions

View File

@ -6421,6 +6421,8 @@ bool secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx,
struct dcinfo **ppdc);
bool secrets_store_generic(const char *owner, const char *key, const char *secret);
char *secrets_fetch_generic(const char *owner, const char *key);
bool secrets_store_local_schannel_key(uint8_t schannel_key[16]);
bool secrets_fetch_local_schannel_key(uint8_t schannel_key[16]);
/* The following definitions come from passdb/util_builtin.c */

View File

@ -45,6 +45,8 @@
#define SECRETS_LDAP_BIND_PW "SECRETS/LDAP_BIND_PW"
#define SECRETS_LOCAL_SCHANNEL_KEY "SECRETS/LOCAL_SCHANNEL_KEY"
/* Authenticated user info is stored in secrets.tdb under these keys */
#define SECRETS_AUTH_USER "SECRETS/AUTH_USER"

View File

@ -259,6 +259,31 @@ bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid)
return True;
}
bool secrets_store_local_schannel_key(uint8_t schannel_key[16])
{
return secrets_store(SECRETS_LOCAL_SCHANNEL_KEY, schannel_key, 16);
}
bool secrets_fetch_local_schannel_key(uint8_t schannel_key[16])
{
size_t size = 0;
uint8_t *key;
key = (uint8_t *)secrets_fetch(SECRETS_LOCAL_SCHANNEL_KEY, &size);
if (key == NULL) {
return false;
}
if (size != 16) {
SAFE_FREE(key);
return false;
}
memcpy(schannel_key, key, 16);
SAFE_FREE(key);
return true;
}
/**
* Form a key for fetching the machine trust account sec channel type
*