diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-11-24 14:16:41 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-11-24 14:16:41 +0000 |
commit | ad2974cd05b4d08c8b92f505bf95aa8e8533235f (patch) | |
tree | 68ed4b1c3c99a13154fb768ba9f4bfcc1a3e7ce9 /source3/passdb | |
parent | 0ebb29e032f2cdbfdb55184c0b97fd1f71b84609 (diff) | |
download | samba-ad2974cd05b4d08c8b92f505bf95aa8e8533235f.tar.gz samba-ad2974cd05b4d08c8b92f505bf95aa8e8533235f.tar.bz2 samba-ad2974cd05b4d08c8b92f505bf95aa8e8533235f.zip |
added "net join" command
this completes the first stage of the smbd ADS support
(This used to be commit 058a5aee901e6609969ef7e1d482a720a84a4a12)
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/secrets.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 86ef024bb0..9002c23d1b 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -1,8 +1,7 @@ /* Unix SMB/Netbios implementation. Version 3.0. - Samba registry functions - Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) Andrew Tridgell 1992-2001 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,7 +52,7 @@ void *secrets_fetch(char *key, size_t *size) { TDB_DATA kbuf, dbuf; if (!tdb) - return False; + return NULL; kbuf.dptr = key; kbuf.dsize = strlen(key); dbuf = tdb_fetch(tdb, kbuf); @@ -142,8 +141,18 @@ BOOL secrets_fetch_trust_account_password(char *domain, uint8 ret_pwd[16], time_t *pass_last_set_time) { struct machine_acct_pass *pass; + char *plaintext; size_t size; + plaintext = secrets_fetch_machine_password(); + if (plaintext) { + /* we have an ADS password - use that */ + DEBUG(4,("Using ADS machine password\n")); + E_md4hash((uchar *)plaintext, ret_pwd); + SAFE_FREE(plaintext); + return True; + } + if (!(pass = secrets_fetch(trust_keystr(domain), &size)) || size != sizeof(*pass)) return False; @@ -169,6 +178,27 @@ BOOL secrets_store_trust_account_password(char *domain, uint8 new_pwd[16]) } /************************************************************************ + Routine to set the plaintext machine account password for a realm +the password is assumed to be a null terminated ascii string +************************************************************************/ +BOOL secrets_store_machine_password(char *pass) +{ + return secrets_store(SECRETS_MACHINE_PASSWORD, pass, strlen(pass)+1); +} + + +/************************************************************************ + 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(void) +{ + return (char *)secrets_fetch(SECRETS_MACHINE_PASSWORD, NULL); +} + + + +/************************************************************************ Routine to delete the trust account password file for a domain. ************************************************************************/ |