svn commit: samba r10214 - in trunk/source: include rpc_parse rpc_server

jerry at samba.org jerry at samba.org
Tue Sep 13 22:15:20 GMT 2005


Author: jerry
Date: 2005-09-13 22:15:19 +0000 (Tue, 13 Sep 2005)
New Revision: 10214

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10214

Log:
Add another info level for QueryServiceConfi2().  Fix one more
error dialog window returned from the MMC service control applet.


Modified:
   trunk/source/include/rpc_svcctl.h
   trunk/source/rpc_parse/parse_svcctl.c
   trunk/source/rpc_server/srv_svcctl_nt.c


Changeset:
Modified: trunk/source/include/rpc_svcctl.h
===================================================================
--- trunk/source/include/rpc_svcctl.h	2005-09-13 22:05:45 UTC (rev 10213)
+++ trunk/source/include/rpc_svcctl.h	2005-09-13 22:15:19 UTC (rev 10214)
@@ -166,11 +166,10 @@
 
 typedef struct {
         uint32 reset_period;
-        UNISTR2 *rebootmsg;
+        UNISTR2 *rebootmsg;	/* i have no idea if these are UNISTR2's.  I can't get a good trace */
         UNISTR2 *command;
-        uint32  nActions;
-        SC_ACTION *saActions;
-        UNISTR2 *description;
+        uint32  num_actions;
+        SC_ACTION *actions;
 } SERVICE_FAILURE_ACTIONS;
 
 typedef struct Service_info_struct {

Modified: trunk/source/rpc_parse/parse_svcctl.c
===================================================================
--- trunk/source/rpc_parse/parse_svcctl.c	2005-09-13 22:05:45 UTC (rev 10213)
+++ trunk/source/rpc_parse/parse_svcctl.c	2005-09-13 22:15:19 UTC (rev 10214)
@@ -793,6 +793,78 @@
 /*******************************************************************
 ********************************************************************/
 
+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 )

Modified: trunk/source/rpc_server/srv_svcctl_nt.c
===================================================================
--- trunk/source/rpc_server/srv_svcctl_nt.c	2005-09-13 22:05:45 UTC (rev 10213)
+++ trunk/source/rpc_server/srv_svcctl_nt.c	2005-09-13 22:15:19 UTC (rev 10214)
@@ -655,17 +655,33 @@
 			description = svcctl_lookup_description( info->name, p->pipe_user.nt_user_token );
 			
 			ZERO_STRUCTP( &desc_buf );
+
 			init_service_description_buffer( &desc_buf, description );
 			svcctl_io_service_description( "", &desc_buf, &r_u->buffer, 0 );
 	                buffer_size = svcctl_sizeof_service_description( &desc_buf );
+
 			break;
 		}
 		break;
+	case SERVICE_CONFIG_FAILURE_ACTIONS:
+		{
+			SERVICE_FAILURE_ACTIONS actions;
 
+			/* nothing to say...just service the request */
+
+			ZERO_STRUCTP( &actions );
+			svcctl_io_service_fa( "", &actions, &r_u->buffer, 0 );
+	                buffer_size = svcctl_sizeof_service_fa( &actions );
+
+			break;
+		}
+		break;
+
 	default:
 		return WERR_UNKNOWN_LEVEL;
 	}
 	
+	buffer_size += buffer_size % 4;
 	r_u->needed = (buffer_size > q_u->buffer_size) ? buffer_size : q_u->buffer_size;
 
         if (buffer_size > q_u->buffer_size )



More information about the samba-cvs mailing list