2006-07-31 15:38:18 +00:00
/*
Unix SMB / CIFS implementation .
Main winbindd irpc handlers
Copyright ( C ) Stefan Metzmacher 2006
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
2007-07-10 02:07:03 +00:00
the Free Software Foundation ; either version 3 of the License , or
2006-07-31 15:38:18 +00:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 02:07:03 +00:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2006-07-31 15:38:18 +00:00
*/
# include "includes.h"
# include "winbind/wb_server.h"
# include "lib/messaging/irpc.h"
# include "libcli/composite/composite.h"
# include "librpc/gen_ndr/ndr_winbind.h"
# include "smbd/service_task.h"
struct wb_irpc_SamLogon_state {
struct irpc_message * msg ;
struct winbind_SamLogon * req ;
} ;
2012-08-24 13:15:42 +02:00
static void wb_irpc_SamLogon_callback ( struct tevent_req * subreq ) ;
2006-07-31 15:38:18 +00:00
static NTSTATUS wb_irpc_SamLogon ( struct irpc_message * msg ,
struct winbind_SamLogon * req )
{
2009-02-01 00:03:47 +01:00
struct wbsrv_service * service = talloc_get_type ( msg - > private_data ,
2006-07-31 15:38:18 +00:00
struct wbsrv_service ) ;
struct wb_irpc_SamLogon_state * s ;
2012-08-24 13:15:42 +02:00
struct tevent_req * subreq ;
2006-07-31 15:38:18 +00:00
DEBUG ( 5 , ( " wb_irpc_SamLogon called \n " ) ) ;
s = talloc ( msg , struct wb_irpc_SamLogon_state ) ;
NT_STATUS_HAVE_NO_MEMORY ( s ) ;
s - > msg = msg ;
s - > req = req ;
2012-08-24 13:15:42 +02:00
subreq = wb_sam_logon_send ( s ,
service - > task - > event_ctx ,
service , req ) ;
NT_STATUS_HAVE_NO_MEMORY ( subreq ) ;
2006-07-31 15:38:18 +00:00
2012-08-24 13:15:42 +02:00
tevent_req_set_callback ( subreq , wb_irpc_SamLogon_callback , s ) ;
2006-07-31 15:38:18 +00:00
2007-10-01 22:13:02 +00:00
msg - > defer_reply = true ;
2006-07-31 15:38:18 +00:00
return NT_STATUS_OK ;
}
2012-08-24 13:15:42 +02:00
static void wb_irpc_SamLogon_callback ( struct tevent_req * subreq )
2006-07-31 15:38:18 +00:00
{
2012-08-24 13:15:42 +02:00
struct wb_irpc_SamLogon_state * s =
tevent_req_callback_data ( subreq ,
struct wb_irpc_SamLogon_state ) ;
2006-07-31 15:38:18 +00:00
NTSTATUS status ;
DEBUG ( 5 , ( " wb_irpc_SamLogon_callback called \n " ) ) ;
2012-08-24 13:15:42 +02:00
status = wb_sam_logon_recv ( subreq , s , s - > req ) ;
TALLOC_FREE ( subreq ) ;
2006-07-31 15:38:18 +00:00
irpc_send_reply ( s - > msg , status ) ;
}
2010-09-17 10:11:48 +10:00
struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state {
struct irpc_message * msg ;
struct winbind_DsrUpdateReadOnlyServerDnsRecords * req ;
} ;
2012-08-24 17:39:58 +02:00
static void wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback ( struct tevent_req * subreq ) ;
2010-09-17 10:11:48 +10:00
static NTSTATUS wb_irpc_DsrUpdateReadOnlyServerDnsRecords ( struct irpc_message * msg ,
struct winbind_DsrUpdateReadOnlyServerDnsRecords * req )
{
struct wbsrv_service * service = talloc_get_type ( msg - > private_data ,
struct wbsrv_service ) ;
struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state * s ;
2012-08-24 17:39:58 +02:00
struct tevent_req * subreq ;
2010-09-17 10:11:48 +10:00
DEBUG ( 5 , ( " wb_irpc_DsrUpdateReadOnlyServerDnsRecords called \n " ) ) ;
s = talloc ( msg , struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state ) ;
NT_STATUS_HAVE_NO_MEMORY ( s ) ;
s - > msg = msg ;
s - > req = req ;
2012-08-24 17:39:58 +02:00
subreq = wb_update_rodc_dns_send ( s ,
service - > task - > event_ctx ,
service , req ) ;
NT_STATUS_HAVE_NO_MEMORY ( subreq ) ;
2010-09-17 10:11:48 +10:00
2012-08-24 17:39:58 +02:00
tevent_req_set_callback ( subreq ,
wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback ,
s ) ;
2010-09-17 10:11:48 +10:00
msg - > defer_reply = true ;
return NT_STATUS_OK ;
}
2012-08-24 17:39:58 +02:00
static void wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback ( struct tevent_req * subreq )
2010-09-17 10:11:48 +10:00
{
2012-08-24 17:39:58 +02:00
struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state * s =
tevent_req_callback_data ( subreq ,
struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state ) ;
2010-09-17 10:11:48 +10:00
NTSTATUS status ;
DEBUG ( 5 , ( " wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback called \n " ) ) ;
2012-08-24 17:39:58 +02:00
status = wb_update_rodc_dns_recv ( subreq , s , s - > req ) ;
TALLOC_FREE ( subreq ) ;
2010-09-17 10:11:48 +10:00
irpc_send_reply ( s - > msg , status ) ;
}
2006-07-31 15:38:18 +00:00
NTSTATUS wbsrv_init_irpc ( struct wbsrv_service * service )
{
NTSTATUS status ;
irpc_add_name ( service - > task - > msg_ctx , " winbind_server " ) ;
status = IRPC_REGISTER ( service - > task - > msg_ctx , winbind , WINBIND_SAMLOGON ,
wb_irpc_SamLogon , service ) ;
NT_STATUS_NOT_OK_RETURN ( status ) ;
2010-09-17 10:11:48 +10:00
status = IRPC_REGISTER ( service - > task - > msg_ctx , winbind , WINBIND_DSRUPDATEREADONLYSERVERDNSRECORDS ,
wb_irpc_DsrUpdateReadOnlyServerDnsRecords , service ) ;
NT_STATUS_NOT_OK_RETURN ( status ) ;
2006-07-31 15:38:18 +00:00
return NT_STATUS_OK ;
}