Re: AD groups and auditing



Russell Fields (russellfields@xxxxxxxxxx) writes:
SQL Server 2005 has the ORIGINAL_LOGIN() function. So, in 2005 the
EXECUTE AS should be manageable, provided that the original login is
what a person actually wants to see. Have you tried using it yet? (I
have not.)

Yes, I know about original_login().

One problem is that there may be code that uses SYSTEM_USER out of habit,
or because it was written for SQL 2000 originally.

Another is that original_login() may not give the user you are looking for.
Say that you authenticate the users in the middle tier. All connections to
SQL Server is made by a proxy user that impersonates the actual user
with the EXECUTE AS statement (or SETUSER). Then there is a stored procedure
with an EXECUTE AS clause. Now SYSTEM_USER will give the login of the
EXECUTE AS clause, and original_login() will give you the proxy login of the
application. The actual user is nowhere to be found. (There is still
SET CONTEXT_INFO and the context_info() function to save the show, but
that's certainly messier.)

--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

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
.



Relevant Pages

  • Re: Output stored procedure
    ... but the .execute command doen't show teh records. ... What object window? ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: grant access to extended properties
    ... Do you know anything about this "EXECUTE AS" for 2000? ... I played around with GRANT but apparently, a member of "db_datareader" ... Reading Books Online tells us that to add extended properties, ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (comp.databases.ms-sqlserver)
  • Re: AD groups and auditing
    ... Erland, Thanks for sharing the chain of dependencies. ... EXECUTE AS should be manageable, provided that the original login is ... SQL Server is made by a proxy user that impersonates the actual user ...
    (microsoft.public.sqlserver.security)
  • Re: Job Fails to Linked Server
    ... If you EXECUTE AS LOGIN you are still ... Links for SQL Server Books Online: ...
    (microsoft.public.sqlserver.connect)
  • Re: User Question
    ... and write capabilities. ... Should that be an SQL login or Windows login? ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.security)