diff options
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/machine_sid.c | 6 | ||||
-rw-r--r-- | source3/passdb/secrets.c | 27 |
2 files changed, 29 insertions, 4 deletions
diff --git a/source3/passdb/machine_sid.c b/source3/passdb/machine_sid.c index ff2c9bcb0d..c7c3cc474b 100644 --- a/source3/passdb/machine_sid.c +++ b/source3/passdb/machine_sid.c @@ -41,15 +41,15 @@ static bool read_sid_from_file(const char *fname, DOM_SID *sid) int numlines; bool ret; - lines = file_lines_load(fname, &numlines,0); + lines = file_lines_load(fname, &numlines,0, NULL); if (!lines || numlines < 1) { - if (lines) file_lines_free(lines); + if (lines) TALLOC_FREE(lines); return False; } ret = string_to_sid(sid, lines[0]); - file_lines_free(lines); + TALLOC_FREE(lines); return ret; } diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 4527ae7127..a6adb904e2 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -238,7 +238,7 @@ bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid) if (!dyn_guid) { if (lp_server_role() == ROLE_DOMAIN_PDC) { - smb_uuid_generate_random(&new_guid); + new_guid = GUID_random(); if (!secrets_store_domain_guid(domain, &new_guid)) return False; dyn_guid = (struct GUID *)secrets_fetch(key, &size); @@ -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 * |