Re: EXECUTE AS question
- From: stavros <stavros@xxxxxxxxxxxxxx>
- Date: Wed, 19 Mar 2008 13:32:17 -0700 (PDT)
On Mar 12, 4:16 pm, Erland Sommarskog <esq...@xxxxxxxxxxxxx> wrote:
stavros (stav...@xxxxxxxxxxxxxx) writes:
The procedure creates successfully, and it does execute under a
different security context - I can see this because the login column =
sa. However, it only returns one record, for the current session only
(as it would for a user without the VIEW SERVER STATE permission). Of
course, if I connect as sa and run sp_who2, I see information from all
sessions.
To be clear, if I log in as sa, sp_who2 returns all sessions (as
expected). The SP
above does in factexecute assa (as expected). However, it
still only lists the current session, as if it's executing without the
VIEW SERVER STATE perm. That's the piece I don't understand, and what
I need a solution for.
This because when you impersonate a user, you are sandboxed into the
current database, unless that database is marked as trustworthy.
An alternative solution is to sign the procedure with a certificate,
and then associate create a login for the certificate, and then grant
that login VIEW SERVER STATE.
I have an article on my web site that covers this in detail:http://www.sommarskog.se/grantperm.html
--
Erland Sommarskog, SQL Server MVP, esq...@xxxxxxxxxxxxx
Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Thanks, Erland! I had read your excellent article, but apparently not
carefully enough. I was able to follow your advice of signing the
procedure with a certificate, and it works beautifully.
Stavros
.
- References:
- EXECUTE AS question
- From: stavros
- Re: EXECUTE AS question
- From: Erland Sommarskog
- EXECUTE AS question
- Prev by Date: Re: user permissions
- Next by Date: Issue with Admin in Sql Server 2005
- Previous by thread: Re: EXECUTE AS question
- Next by thread: Re: Restricting Access priviledge on SQL2000
- Index(es):
Relevant Pages
|
Loading