if (id7 == NULL) {
DEBUG(5, ("set_user_info_7: NULL id7\n"));
- TALLOC_FREE(pwd);
return NT_STATUS_ACCESS_DENIED;
}
if (!id7->account_name.string) {
DEBUG(5, ("set_user_info_7: failed to get new username\n"));
- TALLOC_FREE(pwd);
return NT_STATUS_ACCESS_DENIED;
}
rc = pdb_rename_sam_account(pwd, id7->account_name.string);
- TALLOC_FREE(pwd);
return rc;
}
{
if (id16 == NULL) {
DEBUG(5, ("set_user_info_16: NULL id16\n"));
- TALLOC_FREE(pwd);
return False;
}
/* FIX ME: check if the value is really changed --metze */
if (!pdb_set_acct_ctrl(pwd, id16->acct_flags, PDB_CHANGED)) {
- TALLOC_FREE(pwd);
return False;
}
if(!NT_STATUS_IS_OK(pdb_update_sam_account(pwd))) {
- TALLOC_FREE(pwd);
return False;
}
- TALLOC_FREE(pwd);
-
return True;
}
{
if (id18 == NULL) {
DEBUG(2, ("set_user_info_18: id18 is NULL\n"));
- TALLOC_FREE(pwd);
return False;
}
if (!pdb_set_lanman_passwd (pwd, id18->lm_pwd.hash, PDB_CHANGED)) {
- TALLOC_FREE(pwd);
return False;
}
if (!pdb_set_nt_passwd (pwd, id18->nt_pwd.hash, PDB_CHANGED)) {
- TALLOC_FREE(pwd);
return False;
}
if (!pdb_set_pass_last_set_time (pwd, time(NULL), PDB_CHANGED)) {
- TALLOC_FREE(pwd);
return False;
}
if(!NT_STATUS_IS_OK(pdb_update_sam_account(pwd))) {
- TALLOC_FREE(pwd);
return False;
}
- TALLOC_FREE(pwd);
return True;
}
/* write the change out */
if(!NT_STATUS_IS_OK(pdb_update_sam_account(pwd))) {
- TALLOC_FREE(pwd);
return False;
}
- TALLOC_FREE(pwd);
-
return True;
}
}
if (id21->fields_present & SAMR_FIELD_LAST_PWD_CHANGE) {
- TALLOC_FREE(pwd);
return NT_STATUS_ACCESS_DENIED;
}
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("set_user_info_21: failed to rename account: %s\n",
nt_errstr(status)));
- TALLOC_FREE(pwd);
return status;
}
/* write the change out */
if(!NT_STATUS_IS_OK(status = pdb_update_sam_account(pwd))) {
- TALLOC_FREE(pwd);
return status;
}
- TALLOC_FREE(pwd);
-
return NT_STATUS_OK;
}
}
if (id23->info.fields_present & SAMR_FIELD_LAST_PWD_CHANGE) {
- TALLOC_FREE(pwd);
return NT_STATUS_ACCESS_DENIED;
}
&plaintext_buf,
&len,
STR_UNICODE)) {
- TALLOC_FREE(pwd);
return NT_STATUS_WRONG_PASSWORD;
}
if (!pdb_set_plaintext_passwd (pwd, plaintext_buf)) {
- TALLOC_FREE(pwd);
return NT_STATUS_ACCESS_DENIED;
}
struct passwd *passwd;
if (pdb_get_username(pwd) == NULL) {
DEBUG(1, ("chgpasswd: User without name???\n"));
- TALLOC_FREE(pwd);
return NT_STATUS_ACCESS_DENIED;
}
}
if(!chgpasswd(pdb_get_username(pwd), passwd, "", plaintext_buf, True)) {
- TALLOC_FREE(pwd);
return NT_STATUS_ACCESS_DENIED;
}
TALLOC_FREE(passwd);
if (IS_SAM_CHANGED(pwd, PDB_GROUPSID) &&
(!NT_STATUS_IS_OK(status = pdb_set_unix_primary_group(mem_ctx,
pwd)))) {
- TALLOC_FREE(pwd);
return status;
}
if(!NT_STATUS_IS_OK(status = pdb_update_sam_account(pwd))) {
- TALLOC_FREE(pwd);
return status;
}
- TALLOC_FREE(pwd);
-
return NT_STATUS_OK;
}
&plaintext_buf,
&len,
STR_UNICODE)) {
- TALLOC_FREE(pwd);
return False;
}
if (!pdb_set_plaintext_passwd (pwd, plaintext_buf)) {
- TALLOC_FREE(pwd);
return False;
}
if (pdb_get_username(pwd) == NULL) {
DEBUG(1, ("chgpasswd: User without name???\n"));
- TALLOC_FREE(pwd);
return False;
}
}
if(!chgpasswd(pdb_get_username(pwd), passwd, "", plaintext_buf, True)) {
- TALLOC_FREE(pwd);
return False;
}
TALLOC_FREE(passwd);
/* update the SAMBA password */
if(!NT_STATUS_IS_OK(pdb_update_sam_account(pwd))) {
- TALLOC_FREE(pwd);
return False;
}
- TALLOC_FREE(pwd);
-
return True;
}
}
if (id25->info.fields_present & SAMR_FIELD_LAST_PWD_CHANGE) {
- TALLOC_FREE(pwd);
return NT_STATUS_ACCESS_DENIED;
}
/* write the change out */
if(!NT_STATUS_IS_OK(status = pdb_update_sam_account(pwd))) {
- TALLOC_FREE(pwd);
return status;
}
}
}
- /* WARNING: No TALLOC_FREE(pwd), we are about to set the password
- * hereafter! */
-
return NT_STATUS_OK;
}
done:
+ TALLOC_FREE(pwd);
+
if (has_enough_rights) {
unbecome_root();
}