Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 usp_audit_passwords
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

TimS
Posting Yak Master

USA
198 Posts

Posted - 07/22/2005 :  19:06:57  Show Profile  Reply with Quote
SET QUOTED_IDENTIFIER ON; SET ANSI_NULLS ON
GO

IF OBJECT_ID('dbo.usp_audit_passwords') IS NULL
EXEC ('CREATE PROC dbo.usp_audit_passwords
AS RAISERROR ( ''Dummy Proc Called'', 16, 62)')
GO

ALTER PROC dbo.usp_audit_passwords AS
BEGIN
SET NOCOUNT ON;
IF OBJECT_ID('tempdb..#password') IS NULL
BEGIN
CREATE TABLE #password(
password nvarchar(128) NOT NULL PRIMARY KEY
);
END;

INSERT INTO #password (password)
SELECT src.password
FROM
(
SELECT 'password' UNION ALL
SELECT 'none'
) AS src (password)
LEFT JOIN #password dest ON src.password = dest.password
WHERE dest.password IS NULL

INSERT INTO #password (password)
SELECT DISTINCT l.name
FROM master.dbo.sysxlogins l
WHERE l.name IS NOT NULL AND NOT ((l.xstatus&4) = 4) -- NOT isntname


SELECT l.name, p.password
FROM master.dbo.sysxlogins l
JOIN #password p ON 1 = PWDCOMPARE(p.password, l.password, (CASE WHEN l.xstatus&2048=2048 THEN 1 ELSE 0 END))

END

/***

IF OBJECT_ID('tempdb..#password') IS NOT NULL DROP TABLE #password

CREATE TABLE #password(
password nvarchar(128) NOT NULL PRIMARY KEY
);

INSERT INTO #password (password) VALUES ('checkthispassword')

EXEC dbo.usp_audit_passwords

***/

GO

TimS
Posting Yak Master

USA
198 Posts

Posted - 07/22/2005 :  19:09:14  Show Profile  Reply with Quote
I was reading this thread and thought I could do better; http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=6&messageid=203031&post=true

Tim S
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000