Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / General / Security / May 2008

Tip: Looking for answers? Try searching our database.

xp_logevent and service broker queues

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marcus Müller - 29 May 2008 00:03 GMT
Hi,

I got stuck in the SQL Server 2005 security dependencies and can't find out.
Here's my problem:

I am using the service broker for running asynchronous stored procedures and
have created a queue with

CREATE QUEUE AsyncTargetQueue WITH STATUS = ON, RETENTION = OFF,
                             ACTIVATION(STATUS = ON ,
                                        PROCEDURE_NAME = sp_AsyncReceive,
                                        MAX_QUEUE_READERS = 1,
                                        EXECUTE AS OWNER)

This queue receives all messages and starts the stored procedure
sp_AsyncReceive which is owned by the dbo. The dbo has a login name who is
member of the sysadmin role (sysadmin is required for running the
xp_logevent procedure).

In the sp_AsyncReceive I am calling xp_logevent as user dbo with

EXEC xp_logevent 60000, @evtlogmsg, error

However, the call fails with the following error message in the event log:

'The EXECUTE permission was denied on the object 'xp_logevent', database
'mssqlsystemresource', schema 'sys'.'

Maybe somebody can give me a hint how to call 'sysadmin' functions under the
dbo user or how to change permissions for calling these functions in a
stored procedure which is started by a service broker queue.

Many thanks in advance,

Marcus
Dan Guzman - 29 May 2008 13:59 GMT
> Maybe somebody can give me a hint how to call 'sysadmin' functions under
> the dbo user or how to change permissions for calling these functions in a
> stored procedure which is started by a service broker queue.

With EXECUTE AS OWNER 'dbo', the database owner of your user database needs
to be 'sa' in order for the security context to be 'sa' in master too.
Also, see http://www.sommarskog.se/grantperm.html.

Signature

Hope this helps.

Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

> Hi,
>
[quoted text clipped - 31 lines]
>
> Marcus
Marcus Müller - 29 May 2008 20:04 GMT
Great, sa as owner works. Many thanks ;-)

>> Maybe somebody can give me a hint how to call 'sysadmin' functions under
>> the dbo user or how to change permissions for calling these functions in
[quoted text clipped - 40 lines]
>>
>> Marcus
Erland Sommarskog - 29 May 2008 22:42 GMT
> This queue receives all messages and starts the stored procedure
> sp_AsyncReceive which is owned by the dbo.

Sinec the sp_ prefix is reserved for system procedures, it's not
recommendable to use it for your own procedures.

Signature

Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.