*
* 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
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
/* This is the implementation of the netlogon pipe. */
static void send_sync_message(void)
{
- TDB_CONTEXT *tdb;
-
- tdb = tdb_open_log(lock_path("connections.tdb"), 0,
- TDB_DEFAULT, O_RDONLY, 0);
-
- if (!tdb) {
- DEBUG(3, ("send_sync_message(): failed to open connections "
- "database\n"));
- return;
- }
-
DEBUG(3, ("sending sam synchronisation message\n"));
-
- message_send_all(tdb, MSG_SMB_SAM_SYNC, NULL, 0, False, NULL);
-
- tdb_close(tdb);
+ message_send_all(smbd_messaging_context(), MSG_SMB_SAM_SYNC, NULL, 0,
+ NULL);
}
/*************************************************************************
ret = pdb_getsampwnam(sampass, mach_acct);
unbecome_root();
- if (ret == False) {
+ if (!ret) {
DEBUG(0,("get_md4pw: Workstation %s: no account in domain\n", mach_acct));
TALLOC_FREE(sampass);
return NT_STATUS_ACCESS_DENIED;
}
memcpy(md4pw, pass, 16);
- dump_data(5, md4pw, 16);
+ dump_data(5, (uint8 *)md4pw, 16);
TALLOC_FREE(sampass);
}
/* We must store the creds state after an update. */
+ sampass = samu_new( NULL );
+ if (!sampass) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
become_root();
secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
remote_machine,
p->dc);
- if ( (sampass = samu_new( NULL )) != NULL ) {
- ret = pdb_getsampwnam(sampass, p->dc->mach_acct);
- }
+ ret = pdb_getsampwnam(sampass, p->dc->mach_acct);
unbecome_root();
- if ( !sampass )
- return NT_STATUS_NO_MEMORY;
+ if (!ret) {
+ TALLOC_FREE(sampass);
+ return NT_STATUS_ACCESS_DENIED;
+ }
/* Ensure the account exists and is a machine account. */
acct_ctrl = pdb_get_acct_ctrl(sampass);
- if (!(ret
- && (acct_ctrl & ACB_WSTRUST ||
+ if (!(acct_ctrl & ACB_WSTRUST ||
acct_ctrl & ACB_SVRTRUST ||
- acct_ctrl & ACB_DOMTRUST))) {
+ acct_ctrl & ACB_DOMTRUST)) {
TALLOC_FREE(sampass);
return NT_STATUS_NO_SUCH_USER;
}
return NT_STATUS_NO_MEMORY;
}
- if (!pdb_set_pass_changed_now(sampass)) {
+ if (!pdb_set_pass_last_set_time(sampass, time(NULL), PDB_CHANGED)) {
TALLOC_FREE(sampass);
/* Not quite sure what this one qualifies as, but this will do */
return NT_STATUS_UNSUCCESSFUL;
}
become_root();
- r_u->status = pdb_update_sam_account (sampass);
+ r_u->status = pdb_update_sam_account(sampass);
unbecome_root();
}
user_sid = pdb_get_user_sid(sampw);
group_sid = pdb_get_group_sid(sampw);
+ if ((user_sid == NULL) || (group_sid == NULL)) {
+ DEBUG(1, ("_net_sam_logon: User without group or user SID\n"));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
sid_copy(&domain_sid, user_sid);
sid_split_rid(&domain_sid, &user_rid);