svn commit: samba r21823 - in branches/SAMBA_3_0/source: include
libads libsmb passdb utils
vlendec at samba.org
vlendec at samba.org
Tue Mar 13 16:13:25 GMT 2007
Author: vlendec
Date: 2007-03-13 16:13:24 +0000 (Tue, 13 Mar 2007)
New Revision: 21823
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21823
Log:
Let secrets_store_machine_password() also store the account name. Not used
yet, the next step will be a secrets_fetch_machine_account() function that
also pulls the account name to be used in the appropriate places.
Volker
Modified:
branches/SAMBA_3_0/source/include/secrets.h
branches/SAMBA_3_0/source/libads/util.c
branches/SAMBA_3_0/source/libsmb/trusts_util.c
branches/SAMBA_3_0/source/passdb/secrets.c
branches/SAMBA_3_0/source/utils/net.c
branches/SAMBA_3_0/source/utils/net_domain.c
branches/SAMBA_3_0/source/utils/net_rpc_join.c
Changeset:
Modified: branches/SAMBA_3_0/source/include/secrets.h
===================================================================
--- branches/SAMBA_3_0/source/include/secrets.h 2007-03-13 16:04:17 UTC (rev 21822)
+++ branches/SAMBA_3_0/source/include/secrets.h 2007-03-13 16:13:24 UTC (rev 21823)
@@ -26,6 +26,7 @@
*/
#define SECRETS_MACHINE_ACCT_PASS "SECRETS/$MACHINE.ACC"
#define SECRETS_MACHINE_PASSWORD "SECRETS/MACHINE_PASSWORD"
+#define SECRETS_MACHINE_ACCOUNTNAME "SECRETS/MACHINE_ACCOUNTNAME"
#define SECRETS_MACHINE_LAST_CHANGE_TIME "SECRETS/MACHINE_LAST_CHANGE_TIME"
#define SECRETS_MACHINE_SEC_CHANNEL_TYPE "SECRETS/MACHINE_SEC_CHANNEL_TYPE"
#define SECRETS_MACHINE_TRUST_ACCOUNT_NAME "SECRETS/SECRETS_MACHINE_TRUST_ACCOUNT_NAME"
Modified: branches/SAMBA_3_0/source/libads/util.c
===================================================================
--- branches/SAMBA_3_0/source/libads/util.c 2007-03-13 16:04:17 UTC (rev 21822)
+++ branches/SAMBA_3_0/source/libads/util.c 2007-03-13 16:13:24 UTC (rev 21823)
@@ -42,7 +42,9 @@
goto failed;
}
- if (!secrets_store_machine_password(new_password, lp_workgroup(), sec_channel_type)) {
+ if (!secrets_store_machine_password(new_password, global_myname(),
+ lp_workgroup(),
+ sec_channel_type)) {
DEBUG(1,("Failed to save machine password\n"));
ret = ADS_ERROR_SYSTEM(EACCES);
goto failed;
Modified: branches/SAMBA_3_0/source/libsmb/trusts_util.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/trusts_util.c 2007-03-13 16:04:17 UTC (rev 21822)
+++ branches/SAMBA_3_0/source/libsmb/trusts_util.c 2007-03-13 16:13:24 UTC (rev 21823)
@@ -104,7 +104,10 @@
* Return the result of trying to write the new password
* back into the trust account file.
*/
- if (!secrets_store_machine_password(new_trust_passwd, domain, sec_channel_type)) {
+ if (!secrets_store_machine_password(new_trust_passwd,
+ global_myname(),
+ domain,
+ sec_channel_type)) {
nt_status = NT_STATUS_UNSUCCESSFUL;
}
}
Modified: branches/SAMBA_3_0/source/passdb/secrets.c
===================================================================
--- branches/SAMBA_3_0/source/passdb/secrets.c 2007-03-13 16:04:17 UTC (rev 21822)
+++ branches/SAMBA_3_0/source/passdb/secrets.c 2007-03-13 16:13:24 UTC (rev 21823)
@@ -553,7 +553,10 @@
the password is assumed to be a null terminated ascii string
************************************************************************/
-BOOL secrets_store_machine_password(const char *pass, const char *domain, uint32 sec_channel)
+BOOL secrets_store_machine_password(const char *pass,
+ const char *accountname,
+ const char *domain,
+ uint32 sec_channel)
{
char *key = NULL;
BOOL ret = False;
@@ -581,6 +584,22 @@
goto fail;
}
+ if (asprintf(&key, "%s/%s", SECRETS_MACHINE_ACCOUNTNAME,
+ domain) == -1) {
+ DEBUG(5, ("asprintf failed\n"));
+ goto fail;
+ }
+ strupper_m(key);
+
+ ret = secrets_store(key, accountname, strlen(accountname)+1);
+ SAFE_FREE(key);
+
+ if (!ret) {
+ DEBUG(5, ("secrets_store failed: %s\n",
+ tdb_errorstr(tdb)));
+ goto fail;
+ }
+
if (asprintf(&key, "%s/%s", SECRETS_MACHINE_LAST_CHANGE_TIME,
domain) == -1) {
DEBUG(5, ("asprintf failed\n"));
Modified: branches/SAMBA_3_0/source/utils/net.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net.c 2007-03-13 16:04:17 UTC (rev 21822)
+++ branches/SAMBA_3_0/source/utils/net.c 2007-03-13 16:13:24 UTC (rev 21823)
@@ -555,7 +555,9 @@
trust_pw = get_pass("Enter machine password: ", opt_stdin);
- if (!secrets_store_machine_password(trust_pw, lp_workgroup(), sec_channel_type)) {
+ if (!secrets_store_machine_password(trust_pw, global_myname(),
+ lp_workgroup(),
+ sec_channel_type)) {
d_fprintf(stderr, "Unable to write the machine account password in the secrets database");
return 1;
}
Modified: branches/SAMBA_3_0/source/utils/net_domain.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_domain.c 2007-03-13 16:04:17 UTC (rev 21822)
+++ branches/SAMBA_3_0/source/utils/net_domain.c 2007-03-13 16:13:24 UTC (rev 21823)
@@ -146,7 +146,8 @@
return -1;
}
- if (!secrets_store_machine_password(pw, domain, SEC_CHAN_WKSTA)) {
+ if (!secrets_store_machine_password(pw, global_myname(), domain,
+ SEC_CHAN_WKSTA)) {
DEBUG(1,("Failed to save machine password\n"));
return -1;
}
Modified: branches/SAMBA_3_0/source/utils/net_rpc_join.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_rpc_join.c 2007-03-13 16:04:17 UTC (rev 21822)
+++ branches/SAMBA_3_0/source/utils/net_rpc_join.c 2007-03-13 16:13:24 UTC (rev 21823)
@@ -400,7 +400,9 @@
goto done;
}
- if (!secrets_store_machine_password(clear_trust_password, domain, sec_channel_type)) {
+ if (!secrets_store_machine_password(clear_trust_password,
+ global_myname(), domain,
+ sec_channel_type)) {
DEBUG(0, ("error storing plaintext domain secrets for %s\n", domain));
}
More information about the samba-cvs
mailing list