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.

203 lines
8.5 KiB

  1. <%
  2. '-------------------------------------------------------------------------
  3. ' POP3 Mail Add-in - General include file
  4. ' Copyright (C) Microsoft Corporation. All rights reserved.
  5. '-------------------------------------------------------------------------
  6. '-------------------------------------------------------------------------
  7. ' Global Constants
  8. '-------------------------------------------------------------------------
  9. Const RES_DLL_NAME = "pop3msg.dll"
  10. Const AUTH_AD = "ef9d811e-36c5-497f-ade7-2b36df172824"
  11. Const AUTH_SAM = "14f1665c-e3d3-46aa-884f-ed4cf19d7ad5"
  12. Const AUTH_FILE = "c395e20c-2236-4af7-b736-54fad07dc526"
  13. Const LOGGING_NONE = 0
  14. Const LOGGING_MINIMUM = 1
  15. Const LOGGING_MEDIUM = 2
  16. Const LOGGING_MAXIMUM = 3
  17. Const PARAM_LOCKFLAG = "LOCKFLAG"
  18. Const LOCKFLAG_LOCK = "LOCK"
  19. Const LOCKFLAG_UNLOCK = "UNLOCK"
  20. Const PARAM_DOMAINNAME = "DOMAINNAME"
  21. Const SESSION_POP3DOMAINNAME = "POP3DOMAINNAME"
  22. Const BYTES_PER_MB = 1048576 '1024^2
  23. Const BYTES_PER_KB = 1024
  24. '-------------------------------------------------------------------------
  25. ' Message IDs
  26. '-------------------------------------------------------------------------
  27. Const POP3_TASKS = "&H40010008"
  28. Const POP3_E_UNEXPECTED = "&HC0010010"
  29. ' Master settings
  30. Const POP3_PAGETITLE_MASTERSETTINGS = "&H40010080"
  31. Const POP3_CAPTION_MASTERSETTINGS_AUTHENTICATION = "&H40010088"
  32. Const POP3_AUTHENTICATION_ACTIVEDIRECTORY = "&H40010090"
  33. Const POP3_AUTHENTICATION_WINDOWSACCOUNTS = "&H40010098"
  34. Const POP3_AUTHENTICATION_FILE = "&H400100A0"
  35. Const POP3_CAPTION_MASTERSETTINGS_PORT = "&H400100B0"
  36. Const POP3_CAPTION_MASTERSETTINGS_LOGGING = "&H400100B8"
  37. Const POP3_LOGGING_NONE = "&H400100C0"
  38. Const POP3_LOGGING_MINIMUM = "&H400100C8"
  39. Const POP3_LOGGING_MEDIUM = "&H400100D0"
  40. Const POP3_LOGGING_MAXIMUM = "&H400100D8"
  41. Const POP3_CAPTION_MASTERSETTINGS_MAILROOT = "&H400100E0"
  42. Const POP3_CAPTION_MASTERSETTINGS_CREATEUSERS = "&H400100E8"
  43. Const POP3_PROMPT_MAILROOTCONFIRM = "&H400100F0"
  44. Const POP3_PROMPT_SERVICERESTART_POP3SVC = "&H400100F1"
  45. Const POP3_PROMPT_SERVICERESTART_POP3SVC_SMTP = "&H400100F2"
  46. Const POP3_E_INVALIDPORT = "&HC00100F8"
  47. Const POP3_CAPTION_MASTERSETTINGS_REQUIRESPA = "&H40010010"
  48. ' Domains OTS
  49. Const POP3_PAGETITLE_DOMAINS = "&H40010100"
  50. Const POP3_TABLECAPTION_DOMAINS = "&H40010108"
  51. Const POP3_TASK_DOMAINS_NEW = "&H40010110"
  52. Const POP3_TASKCAPTION_DOMAINS_NEW = "&H40010118"
  53. Const POP3_TASK_DOMAINS_DELETE = "&H40010120"
  54. Const POP3_TASKCAPTION_DOMAINS_DELETE = "&H40010128"
  55. Const POP3_TASK_DOMAINS_MAILBOXES = "&H40010130"
  56. Const POP3_TASKCAPTION_DOMAINS_MAILBOXES = "&H40010138"
  57. Const POP3_TASK_DOMAINS_LOCK = "&H40010140"
  58. Const POP3_TASKCAPTION_DOMAINS_LOCK = "&H40010148"
  59. Const POP3_TASK_DOMAINS_UNLOCK = "&H40010150"
  60. Const POP3_TASKCAPTION_DOMAINS_UNLOCK = "&H40010158"
  61. Const POP3_COL_DOMAIN_NAME = "&H40010160"
  62. Const POP3_COL_DOMAIN_MAILBOXES = "&H40010168"
  63. Const POP3_COL_DOMAIN_SIZE = "&H40010170"
  64. Const POP3_COL_DOMAIN_MESSAGES = "&H40010178"
  65. Const POP3_COL_DOMAIN_LOCKED = "&H40010180"
  66. Const POP3_DOMAIN_LOCKED_YES = "&H40010188"
  67. Const POP3_DOMAIN_LOCKED_NO = "&H40010190"
  68. ' Domains Add
  69. Const POP3_PAGETITLE_DOMAINS_NEW = "&H40010200"
  70. Const POP3_CAPTION_DOMAINS_NEW_NAME = "&H40010208"
  71. Const POP3_CAPTION_DOMAINS_NEW_CREATEUSERS = "&H40010210"
  72. Const POP3_CAPTION_DOMAINS_NEW_SETAUTH = "&H40010218"
  73. ' Domains Delete
  74. Const POP3_PAGETITLE_DOMAINS_DELETE = "&H40010250"
  75. Const POP3_PROMPT_DOMAINS_DELETE = "&H40010258"
  76. Const POP3_PAGETITLE_DOMAINS_DELETEERROR = "&H40010260"
  77. Const POP3_PROMPT_DOMAINS_DELETEERROR = "&H40010268"
  78. Const POP3_PROMPT_DOMAINS_DELETERETRY = "&H40010270"
  79. ' Domains Lock/Unlock
  80. Const POP3_PAGETITLE_DOMAINS_LOCKERROR = "&H400102A0"
  81. Const POP3_PROMPT_DOMAINS_LOCKERROR = "&H400102A8"
  82. Const POP3_PAGETITLE_DOMAINS_UNLOCKERROR = "&H400102B0"
  83. Const POP3_PROMPT_DOMAINS_UNLOCKERROR = "&H400102B8"
  84. Const POP3_PROMPT_DOMAINS_LOCKRETRY = "&H400102C0"
  85. ' Mailboxes OTS
  86. Const POP3_PAGETITLE_MAILBOXES = "&H40010300"
  87. Const POP3_TABLECAPTION_MAILBOXES = "&H40010308"
  88. Const POP3_TASK_MAILBOXES_NEW = "&H40010310"
  89. Const POP3_TASKCAPTION_MAILBOXES_NEW = "&H40010318"
  90. Const POP3_TASK_MAILBOXES_DELETE = "&H40010320"
  91. Const POP3_TASKCAPTION_MAILBOXES_DELETE = "&H40010328"
  92. Const POP3_TASK_MAILBOXES_LOCK = "&H40010330"
  93. Const POP3_TASKCAPTION_MAILBOXES_LOCK = "&H40010338"
  94. Const POP3_TASK_MAILBOXES_UNLOCK = "&H40010340"
  95. Const POP3_TASKCAPTION_MAILBOXES_UNLOCK = "&H40010348"
  96. Const POP3_COL_MAILBOX_NAME = "&H40010350"
  97. Const POP3_COL_MAILBOX_SIZE = "&H40010358"
  98. Const POP3_COL_MAILBOX_MESSAGES = "&H40010360"
  99. Const POP3_COL_MAILBOX_LOCKED = "&H40010368"
  100. Const POP3_MAILBOX_LOCKED_YES = "&H40010370"
  101. Const POP3_MAILBOX_LOCKED_NO = "&H40010378"
  102. ' Mailboxes Add
  103. Const POP3_PAGETITLE_MAILBOXES_NEW = "&H40010400"
  104. Const POP3_CAPTION_MAILBOXES_NEW_NAME = "&H40010408"
  105. Const POP3_CAPTION_MAILBOXES_NEW_PASSWORD = "&H40010410"
  106. Const POP3_CAPTION_MAILBOXES_NEW_CONFIRMPASSWORD = "&H40010418"
  107. Const POP3_CAPTION_MAILBOXES_NEW_CREATEUSERS = "&H40010420"
  108. Const POP3_E_PASSWORDMISMATCH = "&HC0010428"
  109. ' Mailboxes Delete
  110. Const POP3_PAGETITLE_MAILBOXES_DELETE = "&H40010480"
  111. Const POP3_PROMPT_MAILBOXES_DELETE = "&H40010488"
  112. Const POP3_PAGETITLE_MAILBOXES_DELETEERROR = "&H40010490"
  113. Const POP3_PROMPT_MAILBOXES_DELETEERROR = "&H40010498"
  114. Const POP3_PROMPT_MAILBOXES_DELETERETRY = "&H400104A0"
  115. Const POP3_CAPTION_MAILBOXES_DELETEUSER = "&H400104A8"
  116. ' Mailboxes Lock/Unlock
  117. Const POP3_PAGETITLE_MAILBOXES_LOCKERROR = "&H40010500"
  118. Const POP3_PROMPT_MAILBOXES_LOCKERROR = "&H40010508"
  119. Const POP3_PAGETITLE_MAILBOXES_UNLOCKERROR = "&H40010510"
  120. Const POP3_PROMPT_MAILBOXES_UNLOCKERROR = "&H40010518"
  121. Const POP3_PROMPT_MAILBOXES_LOCKRETRY = "&H40010520"
  122. ' Size Factors
  123. Const POP3_FACTOR_MB = "&H40010600"
  124. Const POP3_FACTOR_KB = "&H40010608"
  125. '**********************************************************************
  126. '* H E L P E R S U B R O U T I N E S
  127. '**********************************************************************
  128. '---------------------------------------------------------------------
  129. ' GetDomainName
  130. '---------------------------------------------------------------------
  131. Function GetDomainName()
  132. '
  133. ' Check whether the name was passed on the query string.
  134. '
  135. If (Request.QueryString(PARAM_DOMAINNAME).Count > 0) Then
  136. GetDomainName = Request.QueryString(PARAM_DOMAINNAME).Item(1)
  137. Else
  138. '
  139. ' The value wasn't in the query string. Check the session
  140. ' variable.
  141. '
  142. If (Session(SESSION_POP3DOMAINNAME) <> "") Then
  143. GetDomainName = Session(SESSION_POP3DOMAINNAME)
  144. Else
  145. GetDomainName = ""
  146. End If
  147. End If
  148. End Function
  149. '---------------------------------------------------------------------
  150. ' CalculateDiskUsage
  151. '---------------------------------------------------------------------
  152. Function CalculateDiskUsage(nBytes, nFactor, bInKB)
  153. If ( bInKB ) Then
  154. CalculateDiskUsage = nBytes * nFactor / BYTES_PER_KB
  155. Else
  156. CalculateDiskUsage = nBytes * nFactor / BYTES_PER_MB
  157. End If
  158. End Function
  159. '---------------------------------------------------------------------
  160. ' GetSortableNumber
  161. '
  162. ' Pads a given number with leading zeros so it can be alphabetically
  163. ' compared to other numbers for correct sorting. This will handle
  164. ' numbers up to 999,999,999,999.
  165. '
  166. '---------------------------------------------------------------------
  167. Function GetSortableNumber(nNumber)
  168. Dim strPadding
  169. strPadding = "000000000000"
  170. Dim strNumber
  171. strNumber = FormatNumber(nNumber, 0, -1, 0, 0)
  172. GetSortableNumber = Left(strPadding, Len(strPadding) - Len(strNumber)) & strNumber
  173. End Function
  174. '---------------------------------------------------------------------
  175. ' HandleUnexpectedError
  176. '
  177. ' Wraps SA_SetErrMsg to handle verbose error messages.
  178. '
  179. '---------------------------------------------------------------------
  180. Function HandleUnexpectedError
  181. Dim oConfig, sErrDesc
  182. Set oConfig = Server.CreateObject("P3Admin.P3Config")
  183. oConfig.GetFormattedMessage CLng(Err.number), sErrDesc
  184. HandleUnexpectedError = sErrDesc
  185. End Function
  186. %>