Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
4.2 KiB

  1. USE Winlogon
  2. DECLARE @crlf nvarchar(2)
  3. SET @crlf = CHAR(13) + CHAR(10)
  4. DECLARE @MessageBody nvarchar(4000)
  5. SET @MessageBody = "If you have trouble with your card or your reader and" + @crlf +
  6. "can't logon please send email to the alias smcaft." + @crlf +
  7. @crlf +
  8. "If you think that logon takes very long using smart cards," + @crlf +
  9. "welcome aboard, we think that too. We're working on it..." + @crlf +
  10. @crlf +
  11. "Anyway, please use your card whenever you can." + @crlf +
  12. @crlf +
  13. "Thanks," + @crlf +
  14. "The Smart Card Team"
  15. DECLARE @User nvarchar(64), @stUserlist nvarchar(4000)
  16. SET @stUserlist = ""
  17. DECLARE @Checkdate datetime, @OneMonth datetime
  18. SET @Checkdate = DATEADD(day, -8, GETDATE())
  19. SET @OneMonth = DATEADD(day, -28, GETDATE())
  20. --
  21. --
  22. --
  23. DECLARE UserCursor CURSOR FOR
  24. SELECT DISTINCT USERNAME
  25. FROM AuthMonitor
  26. WHERE CARD <> ""
  27. AND TIMESTAMP > @OneMonth
  28. OPEN UserCursor
  29. FETCH NEXT FROM UserCursor
  30. INTO @User
  31. DECLARE @bSendmail int
  32. SET @bSendmail = 1
  33. WHILE @@FETCH_STATUS = 0
  34. BEGIN
  35. SELECT USERNAME
  36. FROM AuthMonitor
  37. WHERE TIMESTAMP > @Checkdate
  38. AND USERNAME = @User
  39. AND CARD <> ""
  40. IF @@ROWCOUNT = 0
  41. BEGIN
  42. SET @stUserlist = @stUserlist + @User + @crlf
  43. IF @bSendMail <> 0
  44. EXEC master.dbo.xp_sendmail
  45. @recipients = @User,
  46. @message = @MessageBody,
  47. @subject = 'You have not used your smart card in a while...'
  48. END
  49. FETCH NEXT FROM UserCursor
  50. INTO @User
  51. END
  52. CLOSE UserCursor
  53. DEALLOCATE UserCursor
  54. SET @MessageBody = "Smart Card Slackers" + @crlf +
  55. "-------------------" + @crlf +
  56. @stUserlist
  57. IF @bSendmail <> 0
  58. EXEC master.dbo.xp_sendmail
  59. @recipients = 'smcaft',
  60. @message = @MessageBody,
  61. @subject = 'Smart Card Slackers'
  62. ELSE
  63. PRINT @MessageBody
  64. GO