svn commit: samba r10736 - in trunk/source: . rpc_server services

jerry at samba.org jerry at samba.org
Wed Oct 5 19:28:01 GMT 2005


Author: jerry
Date: 2005-10-05 19:28:00 +0000 (Wed, 05 Oct 2005)
New Revision: 10736

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

Log:
adding WINS to supported internal services list
Added:
   trunk/source/services/svc_wins.c
Modified:
   trunk/source/Makefile.in
   trunk/source/rpc_server/srv_svcctl_nt.c
   trunk/source/services/services_db.c


Changeset:
Modified: trunk/source/Makefile.in
===================================================================
--- trunk/source/Makefile.in	2005-10-05 18:37:34 UTC (rev 10735)
+++ trunk/source/Makefile.in	2005-10-05 19:28:00 UTC (rev 10736)
@@ -285,7 +285,8 @@
 
 RPC_SVCCTL_OBJ =  rpc_server/srv_svcctl.o rpc_server/srv_svcctl_nt.o \
                   services/svc_spoolss.o services/svc_rcinit.o services/services_db.o \
-                  services/svc_netlogon.o services/svc_winreg.o
+                  services/svc_netlogon.o services/svc_winreg.o \
+                  services/svc_wins.o
 
 RPC_NTSVCS_OBJ = rpc_server/srv_ntsvcs.o rpc_server/srv_ntsvcs_nt.o
 

Modified: trunk/source/rpc_server/srv_svcctl_nt.c
===================================================================
--- trunk/source/rpc_server/srv_svcctl_nt.c	2005-10-05 18:37:34 UTC (rev 10735)
+++ trunk/source/rpc_server/srv_svcctl_nt.c	2005-10-05 19:28:00 UTC (rev 10736)
@@ -32,10 +32,13 @@
 	SERVICE_CONTROL_OPS *ops;
 };
 
+#define SVCCTL_NUM_INTERNAL_SERVICES	4
+
 extern SERVICE_CONTROL_OPS spoolss_svc_ops;
 extern SERVICE_CONTROL_OPS rcinit_svc_ops;
 extern SERVICE_CONTROL_OPS netlogon_svc_ops;
 extern SERVICE_CONTROL_OPS winreg_svc_ops;
+extern SERVICE_CONTROL_OPS wins_svc_ops;
 
 struct service_control_op *svcctl_ops;
 
@@ -51,7 +54,7 @@
 BOOL init_service_op_table( void )
 {
 	const char **service_list = lp_svcctl_list();
-	int num_services = 3 + str_list_count( service_list );
+	int num_services = SVCCTL_NUM_INTERNAL_SERVICES + str_list_count( service_list );
 	int i;
 	
 	if ( !(svcctl_ops = TALLOC_ARRAY( NULL, struct service_control_op, num_services+1)) ) {
@@ -80,6 +83,10 @@
 	svcctl_ops[i].ops  = &winreg_svc_ops;
 	i++;
 	
+	svcctl_ops[i].name = talloc_strdup( svcctl_ops, "WINS" );
+	svcctl_ops[i].ops  = &wins_svc_ops;
+	i++;
+	
 	/* NULL terminate the array */
 	
 	svcctl_ops[i].name = NULL;

Modified: trunk/source/services/services_db.c
===================================================================
--- trunk/source/services/services_db.c	2005-10-05 18:37:34 UTC (rev 10735)
+++ trunk/source/services/services_db.c	2005-10-05 19:28:00 UTC (rev 10736)
@@ -106,6 +106,12 @@
 		init_unistr2( &description, "Internal service providing remote access to the Samba registry", UNI_STR_TERMINATE );
 		init_unistr2( &dname, "Remote Registry Service", UNI_STR_TERMINATE );
 	} 
+	else if ( strequal(name, "WINS") ) {
+		pstr_sprintf( pstr, "%s/%s/nmbd",dyn_LIBDIR, SVCCTL_SCRIPT_DIR );
+		init_unistr2( &ipath, pstr, UNI_STR_TERMINATE );
+		init_unistr2( &description, "Internal service providing a NetBIOS point-to-point name server", UNI_STR_TERMINATE );
+		init_unistr2( &dname, "Windows Internet Name Service (WINS)", UNI_STR_TERMINATE );
+	} 
 	else {
 		pstr_sprintf( pstr, "%s/%s/%s",dyn_LIBDIR, SVCCTL_SCRIPT_DIR, name );
 		init_unistr2( &ipath, pstr, UNI_STR_TERMINATE );
@@ -251,6 +257,7 @@
 	add_new_svc_name( key, subkeys, "Spooler" );
 	add_new_svc_name( key, subkeys, "NETLOGON" );
 	add_new_svc_name( key, subkeys, "RemoteRegistry" );
+	add_new_svc_name( key, subkeys, "WINS" );
 		
 	for ( i=0; service_list[i]; i++ ) {
 	
@@ -352,29 +359,34 @@
 	/* now add the security descriptor */
 
 	pstr_sprintf( path, "%s\\%s", KEY_SERVICES, name );
-	wresult = regkey_open_internal( &key, path, token, REG_KEY_ALL );
+	wresult = regkey_open_internal( &key, path, token, REG_KEY_READ );
 	if ( !W_ERROR_IS_OK(wresult) ) {
 		DEBUG(0,("svcctl_lookup_dispname: key lookup failed! [%s] (%s)\n", 
 			path, dos_errstr(wresult)));
-		return NULL;
+		goto fail;
 	}
 
 	if ( !(values = TALLOC_ZERO_P( key, REGVAL_CTR )) ) {
 		DEBUG(0,("svcctl_lookup_dispname: talloc() failed!\n"));
 		TALLOC_FREE( key );
-		return NULL;
+		goto fail;
 	}
 
 	fetch_reg_values( key, values );
 	
 	if ( !(val = regval_ctr_getvalue( values, "DisplayName" )) )
-		fstrcpy( display_name, name );
-	else
-		rpcstr_pull( display_name, regval_data_p(val), sizeof(display_name), regval_size(val), 0 );
+		goto fail;
 
+	rpcstr_pull( display_name, regval_data_p(val), sizeof(display_name), regval_size(val), 0 );
+
 	TALLOC_FREE( key );
 	
 	return display_name;
+
+fail:
+	/* default to returning the service name */
+	fstrcpy( display_name, name );
+	return display_name;
 }
 
 /********************************************************************
@@ -392,7 +404,7 @@
 	/* now add the security descriptor */
 
 	pstr_sprintf( path, "%s\\%s", KEY_SERVICES, name );
-	wresult = regkey_open_internal( &key, path, token, REG_KEY_ALL );
+	wresult = regkey_open_internal( &key, path, token, REG_KEY_READ );
 	if ( !W_ERROR_IS_OK(wresult) ) {
 		DEBUG(0,("svcctl_lookup_dispname: key lookup failed! [%s] (%s)\n", 
 			path, dos_errstr(wresult)));
@@ -431,7 +443,7 @@
 	/* now add the security descriptor */
 
 	pstr_sprintf( path, "%s\\%s", KEY_SERVICES, name );
-	wresult = regkey_open_internal( &key, path, token, REG_KEY_ALL );
+	wresult = regkey_open_internal( &key, path, token, REG_KEY_READ );
 	if ( !W_ERROR_IS_OK(wresult) ) {
 		DEBUG(0,("svcctl_fetch_regvalues: key lookup failed! [%s] (%s)\n", 
 			path, dos_errstr(wresult)));

Added: trunk/source/services/svc_wins.c
===================================================================
--- trunk/source/services/svc_wins.c	2005-10-05 18:37:34 UTC (rev 10735)
+++ trunk/source/services/svc_wins.c	2005-10-05 19:28:00 UTC (rev 10736)
@@ -0,0 +1,66 @@
+/* 
+ *  Unix SMB/CIFS implementation.
+ *  Service Control API Implementation
+ *  Copyright (C) Gerald Carter                   2005.
+ *  
+ *  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
+ *  (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
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "includes.h"
+
+/* Implementation for internal wins service */
+
+/*********************************************************************
+*********************************************************************/
+
+static WERROR wins_stop( const char *service, SERVICE_STATUS *service_status )
+{
+	return WERR_ACCESS_DENIED;
+}
+
+/*********************************************************************
+*********************************************************************/
+
+static WERROR wins_start( const char *service )
+{
+	return WERR_ACCESS_DENIED;
+}
+
+/*********************************************************************
+*********************************************************************/
+
+static WERROR wins_status( const char *service, SERVICE_STATUS *service_status )
+{
+	ZERO_STRUCTP( service_status );
+
+	service_status->type              = 0x10;
+	if ( lp_wins_support() ) 
+		service_status->state     = SVCCTL_RUNNING;
+	else
+		service_status->state     = SVCCTL_STOPPED;
+	
+	return WERR_OK;
+}
+
+/*********************************************************************
+*********************************************************************/
+
+/* struct for svcctl control to manipulate wins service */
+
+SERVICE_CONTROL_OPS wins_svc_ops = {
+	wins_stop,
+	wins_start,
+	wins_status
+};



More information about the samba-cvs mailing list