summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_netlog.c
diff options
context:
space:
mode:
authorMatthew Chapman <matty@samba.org>1999-04-08 05:35:53 +0000
committerMatthew Chapman <matty@samba.org>1999-04-08 05:35:53 +0000
commit53f0cd990c3d26e73b42266be35516d6db9621e0 (patch)
tree462f98e3f0a832f8abff97faddd50ec0905aa489 /source3/rpc_server/srv_netlog.c
parente6ea3cc46313a53eaac6bf789f00a91bc02f7a3f (diff)
downloadsamba-53f0cd990c3d26e73b42266be35516d6db9621e0.tar.gz
Mainly BDC-related changes.
* Added SEC_CHAN_BDC * Fix for endianness problem reported by Edan Idzerda <edan@mtu.edu>. A BUFFER2 is really a "unibuf" in my terminology and we should treat it as such. * Added some more common NT structures (BIGINT, BUFHDR2, BUFFER4). * Added NET_SAM_SYNC (-> NetDatabaseSync2) RPC for account replication. Still experimental and incomplete, with a few too many NULL security descriptors lying around (must go look at Jeremy's SD code). Haven't worked out password encryption yet either. However, the XXX_INFO structures I've added to rpc_netlogon.h are quite nice as they give some insight into how these objects are stored in the SAM. (This used to be commit 74d6dec25d6b44e26d3895f789f1958d5f4639ee)
Diffstat (limited to 'source3/rpc_server/srv_netlog.c')
-rw-r--r--source3/rpc_server/srv_netlog.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/source3/rpc_server/srv_netlog.c b/source3/rpc_server/srv_netlog.c
index 33af093625f..c84e91f6433 100644
--- a/source3/rpc_server/srv_netlog.c
+++ b/source3/rpc_server/srv_netlog.c
@@ -224,6 +224,48 @@ static void net_reply_sam_logoff(NET_Q_SAM_LOGOFF *q_s, prs_struct *rdata,
}
+/*************************************************************************
+ net_reply_sam_sync:
+ *************************************************************************/
+static void net_reply_sam_sync(NET_Q_SAM_SYNC *q_s, prs_struct *rdata,
+ DOM_CRED *srv_creds, uint32 status)
+{
+ NET_R_SAM_SYNC r_s;
+ int i = 0;
+ struct sam_passwd *pwd;
+ void *vp;
+
+ memcpy(&(r_s.srv_creds), srv_creds, sizeof(r_s.srv_creds));
+ r_s.sync_context = 1;
+ r_s.ptr_deltas = 0;
+
+ if ((status == 0x0) && ((vp = startsmbpwent(False)) != NULL))
+ {
+ /* Give the poor BDC some accounts */
+
+ while (((pwd = getsam21pwent(vp)) != NULL) && (i < MAX_SAM_DELTAS))
+ {
+ make_sam_delta_hdr(&r_s.hdr_deltas[i], 5, pwd->user_rid);
+ make_sam_account_info(&r_s.deltas[i].account_info,
+ pwd->nt_name, pwd->full_name, pwd->user_rid,
+ pwd->group_rid, pwd->home_dir, pwd->dir_drive,
+ pwd->logon_script, pwd->acct_desc,
+ pwd->acct_ctrl, pwd->profile_path);
+ }
+
+ endsmbpwent(vp);
+
+ r_s.ptr_deltas = r_s.ptr_deltas2 = 1;
+ r_s.num_deltas = r_s.num_deltas2 = i;
+ }
+
+ r_s.status = status;
+
+ /* store the response in the SMB stream */
+ net_io_r_sam_sync("", &r_s, rdata, 0);
+
+}
+
/******************************************************************
gets a machine password entry. checks access rights of the host.
******************************************************************/
@@ -488,6 +530,41 @@ static void api_net_sam_logoff( uint16 vuid,
}
/*************************************************************************
+ api_net_sam_sync:
+ *************************************************************************/
+static void api_net_sam_sync( uint16 vuid,
+ prs_struct *data,
+ prs_struct *rdata)
+{
+ NET_Q_SAM_SYNC q_s;
+ DOM_CRED srv_creds;
+ user_struct *vuser;
+ uint32 status = 0x0;
+
+ if ((vuser = get_valid_user_struct(vuid)) == NULL)
+ return;
+
+ /* grab the challenge... */
+ net_io_q_sam_sync("", &q_s, data, 0);
+
+ /* checks and updates credentials. creates reply credentials */
+ if (deal_with_creds(vuser->dc.sess_key, &(vuser->dc.clnt_cred),
+ &(q_s.cli_creds), &srv_creds))
+ {
+ memcpy(&(vuser->dc.srv_cred), &(vuser->dc.clnt_cred),
+ sizeof(vuser->dc.clnt_cred));
+ }
+ else
+ {
+ status = 0xC0000000 | NT_STATUS_NETWORK_CREDENTIAL_CONFLICT;
+ }
+
+ /* construct reply. */
+ net_reply_sam_sync(&q_s, rdata, &srv_creds, status);
+}
+
+
+/*************************************************************************
net_login_interactive:
*************************************************************************/
static uint32 net_login_interactive(NET_ID_INFO_1 *id1,
@@ -881,6 +958,7 @@ static struct api_struct api_net_cmds [] =
{ "NET_SAMLOGOFF" , NET_SAMLOGOFF , api_net_sam_logoff },
{ "NET_LOGON_CTRL2" , NET_LOGON_CTRL2 , api_net_logon_ctrl2 },
{ "NET_TRUST_DOM_LIST", NET_TRUST_DOM_LIST, api_net_trust_dom_list },
+ { "NET_SAM_SYNC" , NET_SAM_SYNC , api_net_sam_sync },
{ NULL , 0 , NULL }
};