parse_svcctl.c

来自「samba-3.0.22.tar.gz 编译smb服务器的源码」· C语言 代码 · 共 1,138 行 · 第 1/2 页

C
1,138
字号
}/***************************************************************************************************************************************/BOOL svcctl_io_q_enum_dependent_services(const char *desc, SVCCTL_Q_ENUM_DEPENDENT_SERVICES *q_u, prs_struct *ps, int depth){	if (q_u == NULL)		return False;	prs_debug(ps, depth, desc, "svcctl_io_q_enum_dependent_services");	depth++;	if(!prs_align(ps))		return False;	if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))		return False;	if(!prs_uint32("state", ps, depth, &q_u->state))		return False;	if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_r_enum_dependent_services(const char *desc, SVCCTL_R_ENUM_DEPENDENT_SERVICES *r_u, prs_struct *ps, int depth){	if (r_u == NULL)		return False;	prs_debug(ps, depth, desc, "svcctl_io_r_enum_dependent_services");	depth++;	if(!prs_align(ps))		return False;	if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))		return False;	if(!prs_align(ps))		return False;	if(!prs_uint32("needed", ps, depth, &r_u->needed))		return False;	if(!prs_uint32("returned", ps, depth, &r_u->returned))		return False;	if(!prs_werror("status", ps, depth, &r_u->status))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_q_control_service(const char *desc, SVCCTL_Q_CONTROL_SERVICE *q_u, prs_struct *ps, int depth){	if (q_u == NULL)		return False;	prs_debug(ps, depth, desc, "svcctl_io_q_control_service");	depth++;	if(!prs_align(ps))		return False;	if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))		return False;	if(!prs_uint32("control", ps, depth, &q_u->control))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_r_control_service(const char *desc, SVCCTL_R_CONTROL_SERVICE *r_u, prs_struct *ps, int depth){	if (r_u == NULL)		return False;	prs_debug(ps, depth, desc, "svcctl_io_r_control_service");	depth++;	if(!prs_align(ps))		return False;	if(!svcctl_io_service_status("service_status", &r_u->svc_status, ps, depth))		return False;	if(!prs_werror("status", ps, depth, &r_u->status))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_q_query_service_config(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth){	if (q_u == NULL)		return False;	prs_debug(ps, depth, desc, "svcctl_io_q_query_service_config");	depth++;	if(!prs_align(ps))		return False;	if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))		return False;	if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_r_query_service_config(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u, prs_struct *ps, int depth){	if (r_u == NULL)		return False;	prs_debug(ps, depth, desc, "svcctl_io_r_query_service_config");	depth++;	if(!prs_align(ps))		return False;	if(!svcctl_io_service_config("config", &r_u->config, ps, depth))		return False;	if(!prs_uint32("needed", ps, depth, &r_u->needed))		return False;	if(!prs_werror("status", ps, depth, &r_u->status))		return False; 	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, prs_struct *ps, int depth){	if (q_u == NULL)		return False;	prs_debug(ps, depth, desc, "svcctl_io_q_query_service_config2");	depth++;	if(!prs_align(ps))		return False;	if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))		return False;	if(!prs_uint32("level", ps, depth, &q_u->level))		return False;	if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))		return False;	return True;}/***************************************************************************************************************************************/void init_service_description_buffer(SERVICE_DESCRIPTION *desc, const char *service_desc ){	desc->unknown = 0x04;	/* always 0x0000 0004 (no idea what this is) */	init_unistr( &desc->description, service_desc );}/***************************************************************************************************************************************/BOOL svcctl_io_service_description( const char *desc, SERVICE_DESCRIPTION *description, RPC_BUFFER *buffer, int depth ){        prs_struct *ps = &buffer->prs;        prs_debug(ps, depth, desc, "svcctl_io_service_description");        depth++;	if ( !prs_uint32("unknown", ps, depth, &description->unknown) )		return False;	if ( !prs_unistr("description", ps, depth, &description->description) )		return False;	return True;} /***************************************************************************************************************************************/uint32 svcctl_sizeof_service_description( SERVICE_DESCRIPTION *desc ){	if ( !desc )		return 0;	/* make sure to include the terminating NULL */	return ( sizeof(uint32) + (2*(str_len_uni(&desc->description)+1)) );}/***************************************************************************************************************************************/static BOOL svcctl_io_action( const char *desc, SC_ACTION *action, prs_struct *ps, int depth ){	prs_debug(ps, depth, desc, "svcctl_io_action");	depth++;	if ( !prs_uint32("type", ps, depth, &action->type) )		return False;	if ( !prs_uint32("delay", ps, depth, &action->delay) )		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_service_fa( const char *desc, SERVICE_FAILURE_ACTIONS *fa, RPC_BUFFER *buffer, int depth ){        prs_struct *ps = &buffer->prs;	int i;        prs_debug(ps, depth, desc, "svcctl_io_service_description");        depth++;	if ( !prs_uint32("reset_period", ps, depth, &fa->reset_period) )		return False;	if ( !prs_pointer( desc, ps, depth, (void**)&fa->rebootmsg, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) )		return False;	if ( !prs_pointer( desc, ps, depth, (void**)&fa->command, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) )		return False;	if ( !prs_uint32("num_actions", ps, depth, &fa->num_actions) )		return False;	if ( UNMARSHALLING(ps) && fa->num_actions ) {		if ( !(fa->actions = TALLOC_ARRAY( get_talloc_ctx(), SC_ACTION, fa->num_actions )) ) {			DEBUG(0,("svcctl_io_service_fa: talloc() failure!\n"));			return False;		}	}	for ( i=0; i<fa->num_actions; i++ ) {		if ( !svcctl_io_action( "actions", &fa->actions[i], ps, depth ) )			return False;	}	return True;} /***************************************************************************************************************************************/uint32 svcctl_sizeof_service_fa( SERVICE_FAILURE_ACTIONS *fa){	uint32 size = 0;	if ( !fa )		return 0;	size  = sizeof(uint32) * 2;	size += sizeof_unistr2( fa->rebootmsg );	size += sizeof_unistr2( fa->command );	size += sizeof(SC_ACTION) * fa->num_actions;	return size;}/***************************************************************************************************************************************/BOOL svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u, prs_struct *ps, int depth){	if ( !r_u )		return False;	prs_debug(ps, depth, desc, "svcctl_io_r_query_service_config2");	depth++;	if ( !prs_align(ps) )		return False;	if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))		return False;	if(!prs_align(ps))		return False;	if (!prs_uint32("needed", ps, depth, &r_u->needed))		return False;	if(!prs_werror("status", ps, depth, &r_u->status))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_q_query_service_status_ex(const char *desc, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, prs_struct *ps, int depth){	if (q_u == NULL)		return False;	prs_debug(ps, depth, desc, "svcctl_io_q_query_service_status_ex");	depth++;	if(!prs_align(ps))		return False;	if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))		return False;	if(!prs_uint32("level", ps, depth, &q_u->level))		return False;	if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u, prs_struct *ps, int depth){	if ( !r_u )		return False;	prs_debug(ps, depth, desc, "svcctl_io_r_query_service_status_ex");	depth++;	if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))		return False;	if(!prs_align(ps))		return False;	if(!prs_uint32("needed", ps, depth, &r_u->needed))		return False;	if(!prs_werror("status", ps, depth, &r_u->status))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_q_lock_service_db(const char *desc, SVCCTL_Q_LOCK_SERVICE_DB *q_u, prs_struct *ps, int depth){	if (q_u == NULL)		return False;	prs_debug(ps, depth, desc, "svcctl_io_q_lock_service_db");	depth++;	if(!prs_align(ps))		return False;	if(!smb_io_pol_hnd("scm_handle", &q_u->handle, ps, depth))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_r_lock_service_db(const char *desc, SVCCTL_R_LOCK_SERVICE_DB *r_u, prs_struct *ps, int depth){	if ( !r_u )		return False;	prs_debug(ps, depth, desc, "svcctl_io_r_lock_service_db");	depth++;	if(!prs_align(ps))		return False;	if(!smb_io_pol_hnd("lock_handle", &r_u->h_lock, ps, depth))		return False;	if(!prs_werror("status", ps, depth, &r_u->status))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_q_unlock_service_db(const char *desc, SVCCTL_Q_UNLOCK_SERVICE_DB *q_u, prs_struct *ps, int depth){	if (q_u == NULL)		return False;	prs_debug(ps, depth, desc, "svcctl_io_q_unlock_service_db");	depth++;	if(!prs_align(ps))		return False;	if(!smb_io_pol_hnd("h_lock", &q_u->h_lock, ps, depth))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_r_unlock_service_db(const char *desc, SVCCTL_R_UNLOCK_SERVICE_DB *r_u, prs_struct *ps, int depth){	if ( !r_u )		return False;	prs_debug(ps, depth, desc, "svcctl_io_r_unlock_service_db");	depth++;	if(!prs_align(ps))		return False;	if(!prs_werror("status", ps, depth, &r_u->status))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_q_query_service_sec(const char *desc, SVCCTL_Q_QUERY_SERVICE_SEC *q_u, prs_struct *ps, int depth){	if (q_u == NULL)		return False;	prs_debug(ps, depth, desc, "svcctl_io_q_query_service_sec");	depth++;	if(!prs_align(ps))		return False;	if(!smb_io_pol_hnd("handle", &q_u->handle, ps, depth))		return False;	if(!prs_uint32("security_flags", ps, depth, &q_u->security_flags))		return False;	if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_r_query_service_sec(const char *desc, SVCCTL_R_QUERY_SERVICE_SEC *r_u, prs_struct *ps, int depth){	if ( !r_u )		return False;	prs_debug(ps, depth, desc, "svcctl_io_r_query_service_sec");	depth++;	if(!prs_align(ps))		return False;	if (!prs_rpcbuffer("buffer", ps, depth, &r_u->buffer))		return False;	if(!prs_uint32("needed", ps, depth, &r_u->needed))		return False;	if(!prs_werror("status", ps, depth, &r_u->status))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_q_set_service_sec(const char *desc, SVCCTL_Q_SET_SERVICE_SEC *q_u, prs_struct *ps, int depth){	if (q_u == NULL)		return False;	prs_debug(ps, depth, desc, "svcctl_io_q_set_service_sec");	depth++;	if(!prs_align(ps))		return False;	if(!smb_io_pol_hnd("handle", &q_u->handle, ps, depth))		return False;	if(!prs_uint32("security_flags", ps, depth, &q_u->security_flags))		return False;	if (!prs_rpcbuffer("buffer", ps, depth, &q_u->buffer))		return False;	if(!prs_align(ps))		return False;	if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))		return False;	return True;}/***************************************************************************************************************************************/BOOL svcctl_io_r_set_service_sec(const char *desc, SVCCTL_R_SET_SERVICE_SEC *r_u, prs_struct *ps, int depth){	if ( !r_u )		return False;	prs_debug(ps, depth, desc, "svcctl_io_r_set_service_sec");	depth++;	if(!prs_align(ps))		return False;	if(!prs_werror("status", ps, depth, &r_u->status))		return False;	return True;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?