1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

r11316: Kill off a bit more of the old secrets system...

Andrew Bartlett
This commit is contained in:
Andrew Bartlett 2005-10-27 05:31:20 +00:00 committed by Gerald (Jerry) Carter
parent 6a0beb29da
commit c46ef43224

View File

@ -50,7 +50,7 @@ static void get_rand_seed(int *new_seed)
/* close the secrets database */ /* close the secrets database */
void secrets_shutdown(void) void secrets_shutdown(void)
{ {
talloc_free(tdb); talloc_free(tdb);
} }
/* open up the secrets database */ /* open up the secrets database */
@ -87,40 +87,6 @@ BOOL secrets_init(void)
return True; return True;
} }
/* read a entry from the secrets database - the caller must free the result
if size is non-null then the size of the entry is put in there
*/
static void *secrets_fetch(const char *key, size_t *size)
{
TDB_DATA kbuf, dbuf;
secrets_init();
if (!tdb)
return NULL;
kbuf.dptr = (uint8_t *)strdup(key);
kbuf.dsize = strlen(key);
dbuf = tdb_fetch(tdb->tdb, kbuf);
if (size)
*size = dbuf.dsize;
free(kbuf.dptr);
return dbuf.dptr;
}
/************************************************************************
Routine to fetch the plaintext machine account password for a realm
the password is assumed to be a null terminated ascii string
************************************************************************/
char *secrets_fetch_machine_password(const char *domain)
{
char *key;
char *ret;
asprintf(&key, "%s/%s", SECRETS_MACHINE_PASSWORD, domain);
strupper(key);
ret = (char *)secrets_fetch(key, NULL);
free(key);
return ret;
}
/* /*
connect to the schannel ldb connect to the schannel ldb
*/ */