svn commit: samba r7613 - in branches/SAMBA_3_0/source/rpc_server: .
jerry at samba.org
jerry at samba.org
Wed Jun 15 16:32:13 GMT 2005
Author: jerry
Date: 2005-06-15 16:32:12 +0000 (Wed, 15 Jun 2005)
New Revision: 7613
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7613
Log:
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
Modified:
branches/SAMBA_3_0/source/rpc_server/srv_svcctl_nt.c
Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_svcctl_nt.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_server/srv_svcctl_nt.c 2005-06-15 15:55:06 UTC (rev 7612)
+++ branches/SAMBA_3_0/source/rpc_server/srv_svcctl_nt.c 2005-06-15 16:32:12 UTC (rev 7613)
@@ -171,6 +171,7 @@
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,17 +187,24 @@
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;
+ }
}
info->access_granted = access_granted;
@@ -204,11 +212,15 @@
/* 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;
}
/********************************************************************
More information about the samba-cvs
mailing list