mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
s3:secrets: split out a domain_guid_keystr() function
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12782 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
072dd87e63
commit
d37e30cef7
@ -51,6 +51,16 @@ static const char *domain_sid_keystr(const char *domain)
|
|||||||
return keystr;
|
return keystr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *domain_guid_keystr(const char *domain)
|
||||||
|
{
|
||||||
|
char *keystr;
|
||||||
|
|
||||||
|
keystr = talloc_asprintf_strupper_m(talloc_tos(), "%s/%s",
|
||||||
|
SECRETS_DOMAIN_GUID, domain);
|
||||||
|
SMB_ASSERT(keystr != NULL);
|
||||||
|
return keystr;
|
||||||
|
}
|
||||||
|
|
||||||
static const char *protect_ids_keystr(const char *domain)
|
static const char *protect_ids_keystr(const char *domain)
|
||||||
{
|
{
|
||||||
char *keystr;
|
char *keystr;
|
||||||
@ -139,7 +149,7 @@ bool secrets_fetch_domain_sid(const char *domain, struct dom_sid *sid)
|
|||||||
bool secrets_store_domain_guid(const char *domain, struct GUID *guid)
|
bool secrets_store_domain_guid(const char *domain, struct GUID *guid)
|
||||||
{
|
{
|
||||||
char *protect_ids;
|
char *protect_ids;
|
||||||
fstring key;
|
const char *key;
|
||||||
|
|
||||||
protect_ids = secrets_fetch(protect_ids_keystr(domain), NULL);
|
protect_ids = secrets_fetch(protect_ids_keystr(domain), NULL);
|
||||||
if (protect_ids) {
|
if (protect_ids) {
|
||||||
@ -152,24 +162,18 @@ bool secrets_store_domain_guid(const char *domain, struct GUID *guid)
|
|||||||
}
|
}
|
||||||
SAFE_FREE(protect_ids);
|
SAFE_FREE(protect_ids);
|
||||||
|
|
||||||
slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_GUID, domain);
|
key = domain_guid_keystr(domain);
|
||||||
if (!strupper_m(key)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return secrets_store(key, guid, sizeof(struct GUID));
|
return secrets_store(key, guid, sizeof(struct GUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid)
|
bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid)
|
||||||
{
|
{
|
||||||
struct GUID *dyn_guid;
|
struct GUID *dyn_guid;
|
||||||
fstring key;
|
const char *key;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
struct GUID new_guid;
|
struct GUID new_guid;
|
||||||
|
|
||||||
slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_GUID, domain);
|
key = domain_guid_keystr(domain);
|
||||||
if (!strupper_m(key)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
dyn_guid = (struct GUID *)secrets_fetch(key, &size);
|
dyn_guid = (struct GUID *)secrets_fetch(key, &size);
|
||||||
|
|
||||||
if (!dyn_guid) {
|
if (!dyn_guid) {
|
||||||
|
Loading…
Reference in New Issue
Block a user