diff options
author | Andrew Bartlett <abartlet@samba.org> | 2002-03-02 04:45:29 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2002-03-02 04:45:29 +0000 |
commit | 214307e4d95ac204f240b300ed4a435487165e0a (patch) | |
tree | eda72db68f4781d4063d44c70b6157a40fafbe59 /source3/passdb | |
parent | 90b6838751e3eb46394f8a60612a97acbf761538 (diff) | |
download | samba-214307e4d95ac204f240b300ed4a435487165e0a.tar.gz samba-214307e4d95ac204f240b300ed4a435487165e0a.tar.bz2 samba-214307e4d95ac204f240b300ed4a435487165e0a.zip |
Fix up the trusted domains secrets code so as to have a slight chance of
working.
(This used to be commit 4ecc170dcb84522135ddefb5f424cc756051a6d3)
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/secrets.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 5afddfec24..dbcd3e5579 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -189,11 +189,10 @@ BOOL secrets_fetch_trust_account_password(char *domain, uint8 ret_pwd[16], /************************************************************************ Routine to get account password to trusted domain ************************************************************************/ -BOOL secrets_fetch_trusted_domain_password(char *domain, char* pwd, - DOM_SID sid, time_t *pass_last_set_time) +BOOL secrets_fetch_trusted_domain_password(char *domain, char** pwd, + DOM_SID *sid, time_t *pass_last_set_time) { struct trusted_dom_pass *pass; - int pass_len; size_t size; if (!(pass = secrets_fetch(trustdom_keystr(domain), &size))) { @@ -206,13 +205,12 @@ BOOL secrets_fetch_trusted_domain_password(char *domain, char* pwd, return False; } - memcpy(&pass_len, &(pass->pass_len), sizeof(pass_len)); - - if (pwd) - safe_free(pwd); - else - pwd = (char*)malloc(pass_len + 1); - safe_strcpy(pwd, pass->pass, pass_len); + if (pwd) { + *pwd = strdup(pass->pass); + if (!*pwd) { + return False; + } + } if (pass_last_set_time) *pass_last_set_time = pass->mod_time; @@ -249,12 +247,12 @@ BOOL secrets_store_trusted_domain_password(char* domain, char* pwd, DOM_SID sid) { struct trusted_dom_pass pass; + ZERO_STRUCT(pass); pass.mod_time = time(NULL); pass.pass_len = strlen(pwd); - pass.pass = (char*)malloc(strlen(pwd) + 1); - safe_strcpy(pass.pass, pwd, strlen(pwd)); + fstrcpy(pass.pass, pwd); memcpy(&(pass.domain_sid), &sid, sizeof(sid)); |