1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-25 17:57:42 +03:00

r7613: small changes to _svcctl_open_service() and create_open_service_handle() to prevent invalid service names from being accepted; printmig.exe now migrates drivers successfully

(This used to be commit dafb32c01f06c42f44aeb0d16681c5def4903244)
This commit is contained in:
Gerald Carter 2005-06-15 16:32:12 +00:00 committed by Gerald (Jerry) Carter
parent 5b678f7a84
commit 9b43bd3b62

View File

@ -171,6 +171,7 @@ static WERROR create_open_service_handle( pipes_struct *p, POLICY_HND *handle,
const char *service, uint32 access_granted )
{
SERVICE_INFO *info = NULL;
WERROR result = WERR_OK;
if ( !(info = SMB_MALLOC_P( SERVICE_INFO )) )
return WERR_NOMEM;
@ -186,16 +187,23 @@ static WERROR create_open_service_handle( pipes_struct *p, POLICY_HND *handle,
info->type = SVC_HANDLE_IS_SERVICE;
if ( !(info->name = SMB_STRDUP( service )) ) {
free_service_handle_info( info );
WERR_NOMEM;
}
/* lookup the SERVICE_CONTROL_OPS */
for ( i=0; svcctl_ops[i].name; i++ ) {
if ( strequal( svcctl_ops[i].name, service ) )
if ( strequal( svcctl_ops[i].name, service ) ) {
info->ops = svcctl_ops[i].ops;
break;
}
}
if ( !svcctl_ops[i].name ) {
result = WERR_NO_SUCH_SERVICE;
goto done;
}
if ( !(info->name = SMB_STRDUP( service )) ) {
result = WERR_NOMEM;
goto done;
}
}
@ -204,11 +212,15 @@ static WERROR create_open_service_handle( pipes_struct *p, POLICY_HND *handle,
/* store the SERVICE_INFO and create an open handle */
if ( !create_policy_hnd( p, handle, free_service_handle_info, info ) ) {
free_service_handle_info( info );
return WERR_ACCESS_DENIED;
result = WERR_ACCESS_DENIED;
goto done;
}
return WERR_OK;
done:
if ( !W_ERROR_IS_OK(result) )
free_service_handle_info( info );
return result;
}
/********************************************************************