Service Control Functions


データ構造

struct  SvcOpenScm
struct  SvcEnumServices
struct  SvcOpenService
struct  SvcGetStatus
struct  SvcStartService
struct  SvcControlService
struct  SvcStopService
struct  SvcPauseService
struct  SvcContinueService
struct  SvcGetDisplayName
struct  SvcGetServiceConfig

関数

int cac_SvcOpenScm (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcOpenScm *op)
 Opens a handle to the SCM on the remote machine.
int cac_SvcClose (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *scm_hnd)
 Closes an Svc handle (SCM or Service)
int cac_SvcEnumServices (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcEnumServices *op)
 Enumerates services on the remote machine.
int cac_SvcOpenService (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcOpenService *op)
 Opens a handle to a service.
int cac_SvcGetStatus (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcGetStatus *op)
 Retrieves the status of a service.
int cac_SvcStartService (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcStartService *op)
 Attempts to start a service.
int cac_SvcControlService (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcControlService *op)
 Performs a control operation on a service and _immediately_ returns.
int cac_SvcStopService (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcStopService *op)
 Attempts to stop a service.
int cac_SvcPauseService (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcPauseService *op)
 Attempts to pause a service.
int cac_SvcContinueService (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcContinueService *op)
 Attempts to continue a paused service.
int cac_SvcGetDisplayName (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcGetDisplayName *op)
 Retrieves the display name of a service _not currently working_
int cac_SvcGetServiceConfig (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcGetServiceConfig *op)
 Retrieves configuration information about a service.

関数

int cac_SvcOpenScm ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct SvcOpenScm op 
)

Opens a handle to the SCM on the remote machine.

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized parameters
戻り値:
CAC_FAILURE - the operation was not successful hnd->status is set appropriately

CAC_SUCCESS - the operation was successful

cac_svcctl.c31 行で定義されています。

参照先 _CACSERVERHANDLE::_internalSvcOpenScm::accesscac_GetServer()_SMBCSRV::clicli_rpc_pipe_open_noauth()CacServerHandleInternal::ctxerrSvcOpenScm::inSvcOpenScm::outCacServerHandleInternal::pipesrpccli_svcctl_open_scm()SvcOpenScm::scm_hnd_CACSERVERHANDLE::statuswerror_to_ntstatus().

00033 {
00034         SMBCSRV *srv = NULL;
00035         struct rpc_pipe_client *pipe_hnd = NULL;
00036         WERROR err;
00037 
00038         POLICY_HND *scm_out = NULL;
00039 
00040         if ( !hnd )
00041                 return CAC_FAILURE;
00042 
00043         if ( !hnd->_internal.ctx ) {
00044                 hnd->status = NT_STATUS_INVALID_HANDLE;
00045                 return CAC_FAILURE;
00046         }
00047 
00048         if ( !op || op->in.access == 0 || !mem_ctx ) {
00049                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00050                 return CAC_FAILURE;
00051         }
00052 
00053         srv = cac_GetServer( hnd );
00054         if ( !srv ) {
00055                 hnd->status = NT_STATUS_INVALID_CONNECTION;
00056                 return CAC_FAILURE;
00057         }
00058 
00059         /*initialize for samr pipe if we have to */
00060         if ( !hnd->_internal.pipes[PI_SVCCTL] ) {
00061                 if ( !
00062                      ( pipe_hnd =
00063                        cli_rpc_pipe_open_noauth( srv->cli, PI_SVCCTL,
00064                                                  &( hnd->status ) ) ) ) {
00065                         hnd->status = NT_STATUS_UNSUCCESSFUL;
00066                         return CAC_FAILURE;
00067                 }
00068 
00069                 hnd->_internal.pipes[PI_SVCCTL] = True;
00070         }
00071 
00072         scm_out = talloc( mem_ctx, POLICY_HND );
00073         if ( !scm_out ) {
00074                 hnd->status = NT_STATUS_NO_MEMORY;
00075                 return CAC_FAILURE;
00076         }
00077 
00078         err = rpccli_svcctl_open_scm( pipe_hnd, mem_ctx, scm_out,
00079                                       op->in.access );
00080         hnd->status = werror_to_ntstatus( err );
00081 
00082         if ( !NT_STATUS_IS_OK( hnd->status ) )
00083                 return CAC_FAILURE;
00084 
00085         op->out.scm_hnd = scm_out;
00086 
00087         return CAC_SUCCESS;
00088 }

int cac_SvcClose ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
POLICY_HND scm_hnd 
)

Closes an Svc handle (SCM or Service)

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
scm_hnd The handle to close
戻り値:
CAC_FAILURE - the operation was not successful hnd->status is set appropriately

CAC_SUCCESS - the operation was successful

cac_svcctl.c90 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()CacServerHandleInternal::ctxerrrpccli_svcctl_close_service()_CACSERVERHANDLE::statuswerror_to_ntstatus().

00092 {
00093         struct rpc_pipe_client *pipe_hnd = NULL;
00094         WERROR err;
00095 
00096         if ( !hnd )
00097                 return CAC_FAILURE;
00098 
00099         if ( !hnd->_internal.ctx ) {
00100                 hnd->status = NT_STATUS_INVALID_HANDLE;
00101                 return CAC_FAILURE;
00102         }
00103 
00104         if ( !scm_hnd || !mem_ctx ) {
00105                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00106                 return CAC_FAILURE;
00107         }
00108 
00109         pipe_hnd = cac_GetPipe( hnd, PI_SVCCTL );
00110         if ( !pipe_hnd ) {
00111                 hnd->status = NT_STATUS_INVALID_HANDLE;
00112                 return CAC_FAILURE;
00113         }
00114 
00115         err = rpccli_svcctl_close_service( pipe_hnd, mem_ctx, scm_hnd );
00116         hnd->status = werror_to_ntstatus( err );
00117 
00118         if ( !NT_STATUS_IS_OK( hnd->status ) )
00119                 return CAC_FAILURE;
00120 
00121         return CAC_SUCCESS;
00122 }

int cac_SvcEnumServices ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct SvcEnumServices op 
)

Enumerates services on the remote machine.

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized parameters
戻り値:
CAC_FAILURE - the operation was not successful hnd->status is set appropriately

CAC_SUCCESS - the operation was successful

cac_svcctl.c124 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()cac_MakeServiceArray()CacServerHandleInternal::ctxerrSvcEnumServices::inSvcEnumServices::num_servicesSvcEnumServices::outrpccli_svcctl_enumerate_services()SvcEnumServices::scm_hndSvcEnumServices::servicesSvcEnumServices::state_CACSERVERHANDLE::statusSvcEnumServices::typetypewerror_to_ntstatus().

00126 {
00127         struct rpc_pipe_client *pipe_hnd = NULL;
00128         WERROR err;
00129 
00130         uint32 type_buf = 0;
00131         uint32 state_buf = 0;
00132 
00133         uint32 num_svc_out = 0;
00134 
00135         ENUM_SERVICES_STATUS *svc_buf = NULL;
00136 
00137         if ( !hnd )
00138                 return CAC_FAILURE;
00139 
00140         if ( !hnd->_internal.ctx ) {
00141                 hnd->status = NT_STATUS_INVALID_HANDLE;
00142                 return CAC_FAILURE;
00143         }
00144 
00145         if ( !op || !op->in.scm_hnd || !mem_ctx ) {
00146                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00147                 return CAC_FAILURE;
00148         }
00149 
00150         pipe_hnd = cac_GetPipe( hnd, PI_SVCCTL );
00151         if ( !pipe_hnd ) {
00152                 hnd->status = NT_STATUS_INVALID_HANDLE;
00153                 return CAC_FAILURE;
00154         }
00155 
00156         type_buf =
00157                 ( op->in.type !=
00158                   0 ) ? op->in.
00159                 type : ( SVCCTL_TYPE_DRIVER | SVCCTL_TYPE_WIN32 );
00160         state_buf = ( op->in.state != 0 ) ? op->in.state : SVCCTL_STATE_ALL;
00161 
00162         err = rpccli_svcctl_enumerate_services( pipe_hnd, mem_ctx,
00163                                                 op->in.scm_hnd, type_buf,
00164                                                 state_buf, &num_svc_out,
00165                                                 &svc_buf );
00166         hnd->status = werror_to_ntstatus( err );
00167 
00168         if ( !NT_STATUS_IS_OK( hnd->status ) )
00169                 return CAC_FAILURE;
00170 
00171         op->out.services =
00172                 cac_MakeServiceArray( mem_ctx, svc_buf, num_svc_out );
00173 
00174         if ( !op->out.services ) {
00175                 hnd->status = NT_STATUS_NO_MEMORY;
00176                 return CAC_FAILURE;
00177         }
00178 
00179         TALLOC_FREE( svc_buf );
00180 
00181         op->out.num_services = num_svc_out;
00182 
00183         return CAC_SUCCESS;
00184 }

int cac_SvcOpenService ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct SvcOpenService op 
)

Opens a handle to a service.

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parameters
戻り値:
CAC_FAILURE - the operation was not successful hnd->status is set appropriately

CAC_SUCCESS - the operation was successful

cac_svcctl.c186 行で定義されています。

参照先 _CACSERVERHANDLE::_internalSvcOpenService::accesscac_GetPipe()CacServerHandleInternal::ctxerrSvcOpenService::inSvcOpenService::nameSvcOpenService::outrpccli_svcctl_open_service()SvcOpenService::scm_hnd_CACSERVERHANDLE::statusSvcOpenService::svc_hndwerror_to_ntstatus().

00188 {
00189         struct rpc_pipe_client *pipe_hnd = NULL;
00190         WERROR err;
00191 
00192         POLICY_HND *svc_hnd_out = NULL;
00193 
00194         if ( !hnd )
00195                 return CAC_FAILURE;
00196 
00197         if ( !hnd->_internal.ctx ) {
00198                 hnd->status = NT_STATUS_INVALID_HANDLE;
00199                 return CAC_FAILURE;
00200         }
00201 
00202         if ( !op || !op->in.scm_hnd || !op->in.name || !mem_ctx ) {
00203                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00204                 return CAC_FAILURE;
00205         }
00206 
00207         pipe_hnd = cac_GetPipe( hnd, PI_SVCCTL );
00208         if ( !pipe_hnd ) {
00209                 hnd->status = NT_STATUS_INVALID_HANDLE;
00210                 return CAC_FAILURE;
00211         }
00212 
00213         svc_hnd_out = talloc( mem_ctx, POLICY_HND );
00214         if ( !svc_hnd_out ) {
00215                 hnd->status = NT_STATUS_NO_MEMORY;
00216                 return CAC_FAILURE;
00217         }
00218 
00219         err = rpccli_svcctl_open_service( pipe_hnd, mem_ctx, op->in.scm_hnd,
00220                                           svc_hnd_out, op->in.name,
00221                                           op->in.access );
00222         hnd->status = werror_to_ntstatus( err );
00223 
00224         if ( !NT_STATUS_IS_OK( hnd->status ) )
00225                 return CAC_FAILURE;
00226 
00227         op->out.svc_hnd = svc_hnd_out;
00228 
00229         return CAC_SUCCESS;
00230 }

int cac_SvcGetStatus ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct SvcGetStatus op 
)

Retrieves the status of a service.

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parameters
戻り値:
CAC_FAILURE - the operation was not successful hnd->status is set appropriately

CAC_SUCCESS - the operation was successful

cac_svcctl.c276 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()CacServerHandleInternal::ctxerrSvcGetStatus::inSvcGetStatus::outrpccli_svcctl_query_status()_CACSERVERHANDLE::statusSvcGetStatus::statusSvcGetStatus::svc_hndwerror_to_ntstatus().

00278 {
00279         struct rpc_pipe_client *pipe_hnd = NULL;
00280         WERROR err;
00281 
00282         SERVICE_STATUS status_out;
00283 
00284         if ( !hnd )
00285                 return CAC_FAILURE;
00286 
00287         if ( !hnd->_internal.ctx ) {
00288                 hnd->status = NT_STATUS_INVALID_HANDLE;
00289                 return CAC_FAILURE;
00290         }
00291 
00292         if ( !op || !op->in.svc_hnd || !mem_ctx ) {
00293                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00294                 return CAC_FAILURE;
00295         }
00296 
00297         pipe_hnd = cac_GetPipe( hnd, PI_SVCCTL );
00298         if ( !pipe_hnd ) {
00299                 hnd->status = NT_STATUS_INVALID_HANDLE;
00300                 return CAC_FAILURE;
00301         }
00302 
00303         err = rpccli_svcctl_query_status( pipe_hnd, mem_ctx, op->in.svc_hnd,
00304                                           &status_out );
00305         hnd->status = werror_to_ntstatus( err );
00306 
00307         if ( !NT_STATUS_IS_OK( hnd->status ) )
00308                 return CAC_FAILURE;
00309 
00310         op->out.status = status_out;
00311 
00312         return CAC_SUCCESS;
00313 }

int cac_SvcStartService ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct SvcStartService op 
)

Attempts to start a service.

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parameters
戻り値:
CAC_FAILURE - the operation was not successful hnd->status is set appropriately

CAC_SUCCESS - the operation was successful

cac_svcctl.c361 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()cac_WaitForService()CacServerHandleInternal::ctxerrSvcStartService::inSvcStartService::num_parmsSvcStartService::parmsrpccli_svcctl_start_service()_CACSERVERHANDLE::statusSvcStartService::svc_hndSvcStartService::timeoutwerror_to_ntstatus().

00363 {
00364         struct rpc_pipe_client *pipe_hnd = NULL;
00365         WERROR err;
00366 
00367         SERVICE_STATUS status_buf;
00368 
00369         if ( !hnd )
00370                 return CAC_FAILURE;
00371 
00372         if ( !hnd->_internal.ctx ) {
00373                 hnd->status = NT_STATUS_INVALID_HANDLE;
00374                 return CAC_FAILURE;
00375         }
00376 
00377         if ( !op || !op->in.svc_hnd || !mem_ctx ) {
00378                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00379                 return CAC_FAILURE;
00380         }
00381 
00382         if ( op->in.num_parms != 0 && op->in.parms == NULL ) {
00383                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00384                 return CAC_FAILURE;
00385         }
00386 
00387         pipe_hnd = cac_GetPipe( hnd, PI_SVCCTL );
00388         if ( !pipe_hnd ) {
00389                 hnd->status = NT_STATUS_INVALID_HANDLE;
00390                 return CAC_FAILURE;
00391         }
00392 
00393         err = rpccli_svcctl_start_service( pipe_hnd, mem_ctx, op->in.svc_hnd,
00394                                            ( const char ** ) op->in.parms,
00395                                            op->in.num_parms );
00396         hnd->status = werror_to_ntstatus( err );
00397 
00398         if ( !NT_STATUS_IS_OK( hnd->status ) )
00399                 return CAC_FAILURE;
00400 
00401         if ( op->in.timeout == 0 )
00402                 return CAC_SUCCESS;
00403 
00404         return cac_WaitForService( hnd, mem_ctx, op->in.svc_hnd,
00405                                    SVCCTL_RUNNING, op->in.timeout,
00406                                    &status_buf );
00407 }

int cac_SvcControlService ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct SvcControlService op 
)

Performs a control operation on a service and _immediately_ returns.

参照:
cac_SvcStopService()

cac_SvcPauseService()

cac_SvcContinueService()

cac_SvcShutdownService()

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parameters
戻り値:
CAC_FAILURE - the operation was not successful hnd->status is set appropriately

CAC_SUCCESS - the operation was successful

cac_svcctl.c232 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()SvcControlService::controlCacServerHandleInternal::ctxerrSvcControlService::inrpccli_svcctl_control_service()_CACSERVERHANDLE::statusSvcControlService::svc_hndwerror_to_ntstatus().

00234 {
00235         struct rpc_pipe_client *pipe_hnd = NULL;
00236         WERROR err;
00237 
00238         SERVICE_STATUS status_out;
00239 
00240         if ( !hnd )
00241                 return CAC_FAILURE;
00242 
00243         if ( !hnd->_internal.ctx ) {
00244                 hnd->status = NT_STATUS_INVALID_HANDLE;
00245                 return CAC_FAILURE;
00246         }
00247 
00248         if ( !op || !op->in.svc_hnd || !mem_ctx ) {
00249                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00250                 return CAC_FAILURE;
00251         }
00252 
00253         if ( op->in.control < SVCCTL_CONTROL_STOP
00254              || op->in.control > SVCCTL_CONTROL_SHUTDOWN ) {
00255                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00256                 return CAC_FAILURE;
00257         }
00258 
00259         pipe_hnd = cac_GetPipe( hnd, PI_SVCCTL );
00260         if ( !pipe_hnd ) {
00261                 hnd->status = NT_STATUS_INVALID_HANDLE;
00262                 return CAC_FAILURE;
00263         }
00264 
00265         err = rpccli_svcctl_control_service( pipe_hnd, mem_ctx,
00266                                              op->in.svc_hnd, op->in.control,
00267                                              &status_out );
00268         hnd->status = werror_to_ntstatus( err );
00269 
00270         if ( !NT_STATUS_IS_OK( hnd->status ) )
00271                 return CAC_FAILURE;
00272 
00273         return CAC_SUCCESS;
00274 }

int cac_SvcStopService ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct SvcStopService op 
)

Attempts to stop a service.

参照:
cacSvcControlService()
引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parameters
戻り値:
CAC_FAILURE - the operation was not successful. If hnd->status is NT_STATUS_OK, then a timeout occured.

CAC_SUCCESS - the operation was successful

cac_svcctl.c409 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()cac_WaitForService()CacServerHandleInternal::ctxerrSvcStopService::inSvcStopService::outrpccli_svcctl_control_service()_CACSERVERHANDLE::statusSvcStopService::statusSvcStopService::svc_hndSvcStopService::timeoutwerror_to_ntstatus().

00411 {
00412         struct rpc_pipe_client *pipe_hnd = NULL;
00413         WERROR err;
00414 
00415         SERVICE_STATUS status_out;
00416 
00417         if ( !hnd )
00418                 return CAC_FAILURE;
00419 
00420         if ( !hnd->_internal.ctx ) {
00421                 hnd->status = NT_STATUS_INVALID_HANDLE;
00422                 return CAC_FAILURE;
00423         }
00424 
00425         if ( !op || !op->in.svc_hnd || !mem_ctx ) {
00426                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00427                 return CAC_FAILURE;
00428         }
00429 
00430         pipe_hnd = cac_GetPipe( hnd, PI_SVCCTL );
00431         if ( !pipe_hnd ) {
00432                 hnd->status = NT_STATUS_INVALID_HANDLE;
00433                 return CAC_FAILURE;
00434         }
00435 
00436         err = rpccli_svcctl_control_service( pipe_hnd, mem_ctx,
00437                                              op->in.svc_hnd,
00438                                              SVCCTL_CONTROL_STOP,
00439                                              &status_out );
00440         hnd->status = werror_to_ntstatus( err );
00441 
00442         if ( !NT_STATUS_IS_OK( hnd->status ) )
00443                 return CAC_FAILURE;
00444 
00445         op->out.status = status_out;
00446 
00447         if ( op->in.timeout == 0 )
00448                 return CAC_SUCCESS;
00449 
00450         return cac_WaitForService( hnd, mem_ctx, op->in.svc_hnd,
00451                                    SVCCTL_STOPPED, op->in.timeout,
00452                                    &op->out.status );
00453 }

int cac_SvcPauseService ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct SvcPauseService op 
)

Attempts to pause a service.

参照:
cacSvcControlService()
引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parameters
戻り値:
CAC_FAILURE - the operation was not successful. If hnd->status is NT_STATUS_OK, then a timeout occured.

CAC_SUCCESS - the operation was successful

cac_svcctl.c455 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()cac_WaitForService()CacServerHandleInternal::ctxerrSvcPauseService::inSvcPauseService::outrpccli_svcctl_control_service()_CACSERVERHANDLE::statusSvcPauseService::statusSvcPauseService::svc_hndSvcPauseService::timeoutwerror_to_ntstatus().

00457 {
00458         struct rpc_pipe_client *pipe_hnd = NULL;
00459         WERROR err;
00460 
00461         SERVICE_STATUS status_out;
00462 
00463         if ( !hnd )
00464                 return CAC_FAILURE;
00465 
00466         if ( !hnd->_internal.ctx ) {
00467                 hnd->status = NT_STATUS_INVALID_HANDLE;
00468                 return CAC_FAILURE;
00469         }
00470 
00471         if ( !op || !op->in.svc_hnd || !mem_ctx ) {
00472                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00473                 return CAC_FAILURE;
00474         }
00475 
00476         pipe_hnd = cac_GetPipe( hnd, PI_SVCCTL );
00477         if ( !pipe_hnd ) {
00478                 hnd->status = NT_STATUS_INVALID_HANDLE;
00479                 return CAC_FAILURE;
00480         }
00481 
00482         err = rpccli_svcctl_control_service( pipe_hnd, mem_ctx,
00483                                              op->in.svc_hnd,
00484                                              SVCCTL_CONTROL_PAUSE,
00485                                              &status_out );
00486         hnd->status = werror_to_ntstatus( err );
00487 
00488         if ( !NT_STATUS_IS_OK( hnd->status ) )
00489                 return CAC_FAILURE;
00490 
00491         op->out.status = status_out;
00492 
00493         if ( op->in.timeout == 0 )
00494                 return CAC_SUCCESS;
00495 
00496         return cac_WaitForService( hnd, mem_ctx, op->in.svc_hnd,
00497                                    SVCCTL_PAUSED, op->in.timeout,
00498                                    &op->out.status );
00499 }

int cac_SvcContinueService ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct SvcContinueService op 
)

Attempts to continue a paused service.

参照:
cacSvcControlService()
引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parameters
戻り値:
CAC_FAILURE - the operation was not successful. If hnd->status is NT_STATUS_OK, then a timeout occured.

CAC_SUCCESS - the operation was successful

cac_svcctl.c501 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()cac_WaitForService()CacServerHandleInternal::ctxerrSvcContinueService::inSvcContinueService::outrpccli_svcctl_control_service()_CACSERVERHANDLE::statusSvcContinueService::statusSvcContinueService::svc_hndSvcContinueService::timeoutwerror_to_ntstatus().

00503 {
00504         struct rpc_pipe_client *pipe_hnd = NULL;
00505         WERROR err;
00506 
00507         SERVICE_STATUS status_out;
00508 
00509         if ( !hnd )
00510                 return CAC_FAILURE;
00511 
00512         if ( !hnd->_internal.ctx ) {
00513                 hnd->status = NT_STATUS_INVALID_HANDLE;
00514                 return CAC_FAILURE;
00515         }
00516 
00517         if ( !op || !op->in.svc_hnd || !mem_ctx ) {
00518                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00519                 return CAC_FAILURE;
00520         }
00521 
00522         pipe_hnd = cac_GetPipe( hnd, PI_SVCCTL );
00523         if ( !pipe_hnd ) {
00524                 hnd->status = NT_STATUS_INVALID_HANDLE;
00525                 return CAC_FAILURE;
00526         }
00527 
00528         err = rpccli_svcctl_control_service( pipe_hnd, mem_ctx,
00529                                              op->in.svc_hnd,
00530                                              SVCCTL_CONTROL_CONTINUE,
00531                                              &status_out );
00532         hnd->status = werror_to_ntstatus( err );
00533 
00534         if ( !NT_STATUS_IS_OK( hnd->status ) )
00535                 return CAC_FAILURE;
00536 
00537         op->out.status = status_out;
00538 
00539         if ( op->in.timeout == 0 )
00540                 return CAC_SUCCESS;
00541 
00542         return cac_WaitForService( hnd, mem_ctx, op->in.svc_hnd,
00543                                    SVCCTL_RUNNING, op->in.timeout,
00544                                    &op->out.status );
00545 }

int cac_SvcGetDisplayName ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct SvcGetDisplayName op 
)

Retrieves the display name of a service _not currently working_

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parameters
戻り値:
CAC_FAILURE - the operation was not successful hnd->status is set appropriately

CAC_SUCCESS - the operation was successful

cac_svcctl.c547 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()CacServerHandleInternal::ctxSvcGetDisplayName::display_nameerrSvcGetDisplayName::inSvcGetDisplayName::outrpccli_svcctl_get_dispname()_CACSERVERHANDLE::statusSvcGetDisplayName::svc_hndtalloc_strdup()werror_to_ntstatus().

00549 {
00550         struct rpc_pipe_client *pipe_hnd = NULL;
00551         WERROR err;
00552 
00553         fstring disp_name_out;
00554 
00555         if ( !hnd )
00556                 return CAC_FAILURE;
00557 
00558         if ( !hnd->_internal.ctx ) {
00559                 hnd->status = NT_STATUS_INVALID_HANDLE;
00560                 return CAC_FAILURE;
00561         }
00562 
00563         if ( !op || !op->in.svc_hnd || !mem_ctx ) {
00564                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00565                 return CAC_FAILURE;
00566         }
00567 
00568         pipe_hnd = cac_GetPipe( hnd, PI_SVCCTL );
00569         if ( !pipe_hnd ) {
00570                 hnd->status = NT_STATUS_INVALID_HANDLE;
00571                 return CAC_FAILURE;
00572         }
00573 
00574         err = rpccli_svcctl_get_dispname( pipe_hnd, mem_ctx, op->in.svc_hnd,
00575                                           disp_name_out );
00576         hnd->status = werror_to_ntstatus( err );
00577 
00578         if ( !NT_STATUS_IS_OK( hnd->status ) )
00579                 return CAC_FAILURE;
00580 
00581         op->out.display_name = talloc_strdup( mem_ctx, disp_name_out );
00582 
00583         if ( !op->out.display_name ) {
00584                 hnd->status = NT_STATUS_NO_MEMORY;
00585                 return CAC_FAILURE;
00586         }
00587 
00588         return CAC_SUCCESS;
00589 }

int cac_SvcGetServiceConfig ( CacServerHandle hnd,
TALLOC_CTX mem_ctx,
struct SvcGetServiceConfig op 
)

Retrieves configuration information about a service.

引数:
hnd Initialized and connected server handle
mem_ctx Context for memory allocation
op Initialized Parameters
戻り値:
CAC_FAILURE - the operation was not successful hnd->status is set appropriately

CAC_SUCCESS - the operation was successful

cac_svcctl.c592 行で定義されています。

参照先 _CACSERVERHANDLE::_internalcac_GetPipe()cac_InitCacServiceConfig()SvcGetServiceConfig::configCacServerHandleInternal::ctxerrSvcGetServiceConfig::inSvcGetServiceConfig::outrpccli_svcctl_query_config()_CACSERVERHANDLE::statusSvcGetServiceConfig::svc_hndwerror_to_ntstatus().

00594 {
00595         struct rpc_pipe_client *pipe_hnd = NULL;
00596         WERROR err;
00597 
00598         SERVICE_CONFIG config_out;
00599 
00600         if ( !hnd )
00601                 return CAC_FAILURE;
00602 
00603         if ( !hnd->_internal.ctx ) {
00604                 hnd->status = NT_STATUS_INVALID_HANDLE;
00605                 return CAC_FAILURE;
00606         }
00607 
00608         if ( !op || !op->in.svc_hnd || !mem_ctx ) {
00609                 hnd->status = NT_STATUS_INVALID_PARAMETER;
00610                 return CAC_FAILURE;
00611         }
00612 
00613         pipe_hnd = cac_GetPipe( hnd, PI_SVCCTL );
00614         if ( !pipe_hnd ) {
00615                 hnd->status = NT_STATUS_INVALID_HANDLE;
00616                 return CAC_FAILURE;
00617         }
00618 
00619         err = rpccli_svcctl_query_config( pipe_hnd, mem_ctx, op->in.svc_hnd,
00620                                           &config_out );
00621         hnd->status = werror_to_ntstatus( err );
00622 
00623         if ( !NT_STATUS_IS_OK( hnd->status ) )
00624                 return CAC_FAILURE;
00625 
00626         if ( !cac_InitCacServiceConfig
00627              ( mem_ctx, &config_out, &op->out.config ) ) {
00628                 hnd->status = NT_STATUS_NO_MEMORY;
00629                 return CAC_FAILURE;
00630         }
00631 
00632         return CAC_SUCCESS;
00633 
00634 }


Sambaに対してSat Aug 29 21:24:39 2009に生成されました。  doxygen 1.4.7