summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-12-11 04:21:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:47 -0500
commita48955306705ac7f045e3726d7097900550bebe3 (patch)
tree75e4c9f289256f9553f947c76602aba9f1dd7553
parent1e0684678eb1851735c9a3321837ad19ea4aba68 (diff)
downloadsamba-a48955306705ac7f045e3726d7097900550bebe3.tar.gz
samba-a48955306705ac7f045e3726d7097900550bebe3.tar.bz2
samba-a48955306705ac7f045e3726d7097900550bebe3.zip
r12173: doing some service control work
* Add a few new error codes for disabled services * dump some more details about service status in 'net rpc service' * disable the WINS and NetLogon services if not configured in smb.conf Still trying to figure out how to disable the start button on the NetLogon and WINS services. (This used to be commit c0f54eeebc84ec9fab63c5b105511762bcc136be)
-rw-r--r--source3/include/doserr.h2
-rw-r--r--source3/include/rpc_svcctl.h3
-rw-r--r--source3/libsmb/doserr.c1
-rw-r--r--source3/rpc_server/srv_svcctl_nt.c13
-rw-r--r--source3/services/svc_netlogon.c33
-rw-r--r--source3/services/svc_wins.c32
-rw-r--r--source3/utils/net_rpc_service.c1
7 files changed, 58 insertions, 27 deletions
diff --git a/source3/include/doserr.h b/source3/include/doserr.h
index 60c450c819..62c1e4fa22 100644
--- a/source3/include/doserr.h
+++ b/source3/include/doserr.h
@@ -196,6 +196,8 @@
#define WERR_REG_FILE_INVALID W_ERROR(1017)
#define WERR_NO_SUCH_SERVICE W_ERROR(1060)
#define WERR_INVALID_SERVICE_CONTROL W_ERROR(1052)
+#define WERR_SERVICE_DISABLED W_ERROR(1058)
+#define WERR_SERVICE_NEVER_STARTED W_ERROR(1077)
#define WERR_MACHINE_LOCKED W_ERROR(1271)
#define WERR_INVALID_SECURITY_DESCRIPTOR W_ERROR(1338)
#define WERR_EVENTLOG_FILE_CORRUPT W_ERROR(1500)
diff --git a/source3/include/rpc_svcctl.h b/source3/include/rpc_svcctl.h
index f5ad2afa1c..4a058999a3 100644
--- a/source3/include/rpc_svcctl.h
+++ b/source3/include/rpc_svcctl.h
@@ -69,6 +69,7 @@
/* SERVER_STATUS - ControlAccepted */
+#define SVCCTL_ACCEPT_NONE 0x00000000
#define SVCCTL_ACCEPT_STOP 0x00000001
#define SVCCTL_ACCEPT_PAUSE_CONTINUE 0x00000002
#define SVCCTL_ACCEPT_SHUTDOWN 0x00000004
@@ -126,7 +127,7 @@ typedef struct {
uint32 type;
uint32 state;
uint32 controls_accepted;
- uint32 win32_exit_code;
+ WERROR win32_exit_code;
uint32 service_exit_code;
uint32 check_point;
uint32 wait_hint;
diff --git a/source3/libsmb/doserr.c b/source3/libsmb/doserr.c
index dd0358f69a..253164963a 100644
--- a/source3/libsmb/doserr.c
+++ b/source3/libsmb/doserr.c
@@ -76,6 +76,7 @@ werror_code_struct dos_errs[] =
{ "WERR_REG_CORRUPT", WERR_REG_CORRUPT },
{ "WERR_REG_IO_FAILURE", WERR_REG_IO_FAILURE },
{ "WERR_REG_FILE_INVALID", WERR_REG_FILE_INVALID },
+ { "WERR_SERVICE_DISABLED", WERR_SERVICE_DISABLED },
{ NULL, W_ERROR(0) }
};
diff --git a/source3/rpc_server/srv_svcctl_nt.c b/source3/rpc_server/srv_svcctl_nt.c
index bbf313f7fa..97c38753c3 100644
--- a/source3/rpc_server/srv_svcctl_nt.c
+++ b/source3/rpc_server/srv_svcctl_nt.c
@@ -615,9 +615,20 @@ static WERROR fill_svc_config( TALLOC_CTX *ctx, const char *name, SERVICE_CONFIG
config->tag_id = 0x00000000; /* unassigned loadorder group */
config->service_type = SVCCTL_WIN32_OWN_PROC;
- config->start_type = SVCCTL_DEMAND_START;
config->error_control = SVCCTL_SVC_ERROR_NORMAL;
+ /* set the start type. NetLogon and WINS are disabled to prevent
+ the client from showing the "Start" button (if of course the services
+ are not running */
+
+ if ( strequal( name, "NETLOGON" ) && ( lp_servicenumber(name) == -1 ) )
+ config->start_type = SVCCTL_DISABLED;
+ else if ( strequal( name, "WINS" ) && ( !lp_wins_support() ))
+ config->start_type = SVCCTL_DISABLED;
+ else
+ config->start_type = SVCCTL_DEMAND_START;
+
+
TALLOC_FREE( values );
return WERR_OK;
diff --git a/source3/services/svc_netlogon.c b/source3/services/svc_netlogon.c
index 2aa5a31cde..1bbef325ac 100644
--- a/source3/services/svc_netlogon.c
+++ b/source3/services/svc_netlogon.c
@@ -25,33 +25,42 @@
/*********************************************************************
*********************************************************************/
-static WERROR netlogon_stop( const char *service, SERVICE_STATUS *service_status )
+static WERROR netlogon_status( const char *service, SERVICE_STATUS *service_status )
{
- return WERR_ACCESS_DENIED;
+ ZERO_STRUCTP( service_status );
+
+ service_status->type = 0x20;
+ service_status->controls_accepted = SVCCTL_ACCEPT_NONE;
+
+ if ( lp_servicenumber("NETLOGON") != -1 ) {
+ service_status->state = SVCCTL_RUNNING;
+ service_status->win32_exit_code = WERR_SERVICE_NEVER_STARTED;
+ }
+ else
+ service_status->state = SVCCTL_STOPPED;
+
+ return WERR_OK;
}
/*********************************************************************
*********************************************************************/
-static WERROR netlogon_start( const char *service )
+static WERROR netlogon_stop( const char *service, SERVICE_STATUS *service_status )
{
+ netlogon_status( service, service_status );
+
return WERR_ACCESS_DENIED;
}
/*********************************************************************
*********************************************************************/
-static WERROR netlogon_status( const char *service, SERVICE_STATUS *service_status )
+static WERROR netlogon_start( const char *service )
{
- ZERO_STRUCTP( service_status );
+ if ( lp_servicenumber("NETLOGON") == -1 )
+ return WERR_SERVICE_DISABLED;
- service_status->type = 0x20;
- if ( lp_servicenumber("NETLOGON") != -1 )
- service_status->state = SVCCTL_RUNNING;
- else
- service_status->state = SVCCTL_STOPPED;
-
- return WERR_OK;
+ return WERR_ACCESS_DENIED;
}
/*********************************************************************
diff --git a/source3/services/svc_wins.c b/source3/services/svc_wins.c
index 3a4650664d..37cfc99c06 100644
--- a/source3/services/svc_wins.c
+++ b/source3/services/svc_wins.c
@@ -25,33 +25,39 @@
/*********************************************************************
*********************************************************************/
-static WERROR wins_stop( const char *service, SERVICE_STATUS *service_status )
+static WERROR wins_status( const char *service, SERVICE_STATUS *service_status )
{
- return WERR_ACCESS_DENIED;
+ ZERO_STRUCTP( service_status );
+
+ service_status->type = 0x10;
+ service_status->controls_accepted = SVCCTL_ACCEPT_NONE;
+
+ if ( lp_wins_support() )
+ service_status->state = SVCCTL_RUNNING;
+ else {
+ service_status->state = SVCCTL_STOPPED;
+ service_status->win32_exit_code = WERR_SERVICE_NEVER_STARTED;
+ }
+
+ return WERR_OK;
}
/*********************************************************************
*********************************************************************/
-static WERROR wins_start( const char *service )
+static WERROR wins_stop( const char *service, SERVICE_STATUS *service_status )
{
+ wins_status( service, service_status );
+
return WERR_ACCESS_DENIED;
}
/*********************************************************************
*********************************************************************/
-static WERROR wins_status( const char *service, SERVICE_STATUS *service_status )
+static WERROR wins_start( const char *service )
{
- 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;
+ return WERR_ACCESS_DENIED;
}
/*********************************************************************
diff --git a/source3/utils/net_rpc_service.c b/source3/utils/net_rpc_service.c
index 3cc4790884..ed7d1dfab1 100644
--- a/source3/utils/net_rpc_service.c
+++ b/source3/utils/net_rpc_service.c
@@ -254,6 +254,7 @@ static NTSTATUS rpc_service_status_internal(const DOM_SID *domain_sid,
/* print out the configuration information for the service */
d_printf("Configuration details:\n");
+ d_printf("\tControls Accepted = 0x%x\n", service_status.controls_accepted);
d_printf("\tService Type = 0x%x\n", config.service_type);
d_printf("\tStart Type = 0x%x\n", config.start_type);
d_printf("\tError Control = 0x%x\n", config.error_control);