svn commit: samba r10741 - in trunk/source: include services

jerry at samba.org jerry at samba.org
Wed Oct 5 21:52:35 GMT 2005


Author: jerry
Date: 2005-10-05 21:52:33 +0000 (Wed, 05 Oct 2005)
New Revision: 10741

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

Log:
* removing unused service_info structure
* start adding displaynames for common unix services
* fix bug in previous changes for internal service descriptions


Modified:
   trunk/source/include/rpc_svcctl.h
   trunk/source/services/services_db.c
   trunk/source/services/svc_rcinit.c


Changeset:
Modified: trunk/source/include/rpc_svcctl.h
===================================================================
--- trunk/source/include/rpc_svcctl.h	2005-10-05 20:46:49 UTC (rev 10740)
+++ trunk/source/include/rpc_svcctl.h	2005-10-05 21:52:33 UTC (rev 10741)
@@ -175,23 +175,6 @@
         SC_ACTION *actions;
 } SERVICE_FAILURE_ACTIONS;
 
-typedef struct Service_info_struct {
-	uint32  type;		/* should be SVC_HANDLE_IS_SERVICE */
-	pstring servicename;	/* the name of the service */
-	pstring servicetype;	/* internal or external */
-	pstring filename;	/* what file name we can find this in, 
-				   as well as the "index" for what the 
-				   service name is */
-	pstring provides;
-	pstring dependencies;
-	pstring shouldstart;
-	pstring shouldstop;
-	pstring requiredstart;
-	pstring	requiredstop;
-	pstring shortdescription;
-	pstring description;
-} Service_info;
-
 /* 
  * dispatch table of functions to handle the =ServiceControl API
  */ 

Modified: trunk/source/services/services_db.c
===================================================================
--- trunk/source/services/services_db.c	2005-10-05 20:46:49 UTC (rev 10740)
+++ trunk/source/services/services_db.c	2005-10-05 21:52:33 UTC (rev 10741)
@@ -23,14 +23,14 @@
 
 #include "includes.h"
 
-struct internal_service_info {
+struct service_display_info {
 	const char *servicename;
 	const char *daemon;
 	const char *dispname;
 	const char *description;
 };
 
-struct internal_service_info builtin_svcs[] = {  
+struct service_display_info builtin_svcs[] = {  
   { "Spooler",	      "smbd", "Print Spooler",
   	"Internal service for spooling files to print devices" },
   { "NETLOGON",	      "smbd", "Net Logon",
@@ -42,6 +42,34 @@
   { NULL, NULL, NULL, NULL }
 };
 
+struct service_display_info common_unix_svcs[] = {  
+  { "cups",          NULL, "Common Unix Printing System", NULL },
+  { "postfix",       NULL, "Internet Mail Service", NULL },
+  { "sendmail",      NULL, "Internet Mail Service", NULL },
+  { "portmap",       NULL, "TCP Port to RPC PortMapper", NULL },
+  { "xinetd",        NULL, "Internet Meta-Daemon", NULL },
+  { "inet",          NULL, "Internet Meta-Daemon", NULL },
+  { "xntpd",         NULL, "Network Time Service", NULL },
+  { "ntpd",          NULL, "Network Time Service", NULL },
+  { "lpd",           NULL, "BSD Print Spooler", NULL },
+  { "nfsserver",     NULL, "Network File Service", NULL },
+  { "cron",          NULL, "Scheduling Service", NULL },
+  { "at",            NULL, "Scheduling Service", NULL },
+  { "nscd",          NULL, "Name Service Cache Daemon", NULL },
+  { "slapd",         NULL, "LDAP Directory Service", NULL },
+  { "ldap",          NULL, "LDAP DIrectory Service", NULL },
+  { "ypbind",        NULL, "NIS Directory Service", NULL },
+  { "courier-imap",  NULL, "NIS Directory Service", NULL },
+  { "named",         NULL, "Domain Name Service", NULL },
+  { "bind",          NULL, "Domain Name Service", NULL },
+  { "httpd",         NULL, "HTTP Server", NULL },
+  { "apache",        NULL, "HTTP Server", NULL },
+  { "autofs",        NULL, "Automounter", NULL },
+  { "squid",         NULL, "Web Cache Proxy ", NULL },
+  { NULL, NULL, NULL, NULL }
+};
+
+
 /********************************************************************
 ********************************************************************/
 
@@ -82,6 +110,31 @@
  Display name, Description, etc...
 ********************************************************************/
 
+static char *get_common_service_dispname( const char *servicename )
+{
+	static fstring dispname;
+	int i;
+	
+	for ( i=0; common_unix_svcs[i].servicename; i++ ) {
+		if ( strequal( servicename, common_unix_svcs[i].servicename ) ) {
+			fstr_sprintf( dispname, "%s (%s)", 
+				common_unix_svcs[i].dispname,
+				common_unix_svcs[i].servicename );
+				
+			return dispname;
+		}
+	} 
+	
+	fstrcpy( dispname, servicename );
+	
+	return dispname;
+}
+
+/********************************************************************
+ This is where we do the dirty work of filling in things like the
+ Display name, Description, etc...
+********************************************************************/
+
 static void fill_service_values( const char *name, REGVAL_CTR *values )
 {
 	UNISTR2 data, dname, ipath, description;
@@ -114,6 +167,7 @@
 			init_unistr2( &ipath, pstr, UNI_STR_TERMINATE );
 			init_unistr2( &description, builtin_svcs[i].description, UNI_STR_TERMINATE );
 			init_unistr2( &dname, builtin_svcs[i].dispname, UNI_STR_TERMINATE );
+			break;
 		}
 	} 
 	
@@ -123,7 +177,7 @@
 		pstr_sprintf( pstr, "%s/%s/%s",dyn_LIBDIR, SVCCTL_SCRIPT_DIR, name );
 		init_unistr2( &ipath, pstr, UNI_STR_TERMINATE );
 		init_unistr2( &description, "External Unix Service", UNI_STR_TERMINATE );
-		init_unistr2( &dname, name, UNI_STR_TERMINATE );
+		init_unistr2( &dname, get_common_service_dispname( name ), UNI_STR_TERMINATE );
 	}
 	
 	/* add the new values */

Modified: trunk/source/services/svc_rcinit.c
===================================================================
--- trunk/source/services/svc_rcinit.c	2005-10-05 20:46:49 UTC (rev 10740)
+++ trunk/source/services/svc_rcinit.c	2005-10-05 21:52:33 UTC (rev 10741)
@@ -21,6 +21,7 @@
 
 #include "includes.h"
 
+#if 0
 /* Implementation for LSB compliant init scripts */
 
 /*******************************************************************************
@@ -30,7 +31,7 @@
  Get the names of the services/scripts to read from the smb.conf file.
 *******************************************************************************/
 
-BOOL get_LSB_data(char *fname,Service_info *si )
+static BOOL get_LSB_data(char *fname,Service_info *si )
 {
 	pstring initdfile;
 	char mybuffer[256];
@@ -167,6 +168,7 @@
 
 	return False;
 }
+#endif
 
 /*********************************************************************
 *********************************************************************/



More information about the samba-cvs mailing list