mirror of
https://github.com/samba-team/samba.git
synced 2025-01-15 23:24:37 +03:00
Whenever we deal with adding machine/trusted domain accounts, always reset the
flag to what we expect. This handles the 'upgrade' from unixsam beter (where all $ terminated accounts are machines). Andrew Bartlett (This used to be commit a198940ea6f7b7f3cba38c5a9f695e0731204583)
This commit is contained in:
parent
059838a843
commit
31b131b0e9
@ -1003,6 +1003,7 @@ BOOL local_password_change(const char *user_name, int local_flags,
|
||||
{
|
||||
struct passwd *pwd = NULL;
|
||||
SAM_ACCOUNT *sam_pass=NULL;
|
||||
uint16 other_acb;
|
||||
|
||||
*err_str = '\0';
|
||||
*msg_str = '\0';
|
||||
@ -1042,31 +1043,33 @@ BOOL local_password_change(const char *user_name, int local_flags,
|
||||
return False;
|
||||
}
|
||||
}
|
||||
if (local_flags & LOCAL_TRUST_ACCOUNT) {
|
||||
if (!pdb_set_acct_ctrl(sam_pass, ACB_WSTRUST)) {
|
||||
slprintf(err_str, err_str_len - 1, "Failed to set 'trusted workstation account' flags for user %s.\n", user_name);
|
||||
pdb_free_sam(&sam_pass);
|
||||
return False;
|
||||
}
|
||||
} else if (local_flags & LOCAL_INTERDOM_ACCOUNT) {
|
||||
if (!pdb_set_acct_ctrl(sam_pass, ACB_DOMTRUST)) {
|
||||
slprintf(err_str, err_str_len - 1, "Failed to set 'domain trust account' flags for user %s.\n", user_name);
|
||||
pdb_free_sam(&sam_pass);
|
||||
return False;
|
||||
}
|
||||
} else {
|
||||
if (!pdb_set_acct_ctrl(sam_pass, ACB_NORMAL)) {
|
||||
slprintf(err_str, err_str_len - 1, "Failed to set 'normal account' flags for user %s.\n", user_name);
|
||||
pdb_free_sam(&sam_pass);
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
/* the entry already existed */
|
||||
local_flags &= ~LOCAL_ADD_USER;
|
||||
}
|
||||
|
||||
/* the 'other' acb bits not being changed here */
|
||||
other_acb = (pdb_get_acct_ctrl(sam_pass) & (!(ACB_WSTRUST|ACB_DOMTRUST|ACB_SVRTRUST|ACB_NORMAL)));
|
||||
if (local_flags & LOCAL_TRUST_ACCOUNT) {
|
||||
if (!pdb_set_acct_ctrl(sam_pass, ACB_WSTRUST | other_acb) ) {
|
||||
slprintf(err_str, err_str_len - 1, "Failed to set 'trusted workstation account' flags for user %s.\n", user_name);
|
||||
pdb_free_sam(&sam_pass);
|
||||
return False;
|
||||
}
|
||||
} else if (local_flags & LOCAL_INTERDOM_ACCOUNT) {
|
||||
if (!pdb_set_acct_ctrl(sam_pass, ACB_DOMTRUST | other_acb)) {
|
||||
slprintf(err_str, err_str_len - 1, "Failed to set 'domain trust account' flags for user %s.\n", user_name);
|
||||
pdb_free_sam(&sam_pass);
|
||||
return False;
|
||||
}
|
||||
} else {
|
||||
if (!pdb_set_acct_ctrl(sam_pass, ACB_NORMAL | other_acb)) {
|
||||
slprintf(err_str, err_str_len - 1, "Failed to set 'normal account' flags for user %s.\n", user_name);
|
||||
pdb_free_sam(&sam_pass);
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We are root - just write the new password
|
||||
* and the valid last change time.
|
||||
|
Loading…
x
Reference in New Issue
Block a user