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.

100 lines
2.4 KiB

  1. #include <nt.h>
  2. #include <ntrtl.h>
  3. #include <nturtl.h>
  4. #include <windows.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <stddef.h>
  8. #include <shellapi.h>
  9. #include "..\..\lib\dfsgram\dfsobjectdef.h"
  10. #include <dfsadmin.h>
  11. VOID
  12. DumpLink(
  13. PLINK_DEF pLink )
  14. {
  15. PTARGET_DEF pTarget;
  16. printf("Link %wS\n", pLink->LinkObjectName);
  17. for (pTarget = pLink->LinkObjectTargets; pTarget != NULL; pTarget = pTarget->NextTarget)
  18. {
  19. printf("\tTarget %wS\n", pTarget->Name);
  20. }
  21. }
  22. DFSSTATUS
  23. VerifyTarget(
  24. PLINK_DEF pLink,
  25. PTARGET_DEF pTarget)
  26. {
  27. if (IsInScript(pTarget) && IsInNameSpace(pTarget))
  28. {
  29. return ERROR_SUCCESS;
  30. }
  31. else if (IsInScript(pTarget))
  32. {
  33. printf("/t Target %wS for link %wS is not in the namespace\n",
  34. pTarget->Name,
  35. pLink->LinkObjectName);
  36. }
  37. else if (IsObjectInNameSpace(pLink))
  38. {
  39. printf("/t Target %wS for link %wS is additional in the namespace\n",
  40. pTarget->Name,
  41. pLink->LinkObjectName);
  42. }
  43. else
  44. {
  45. printf("Script error for target %wS link %wS!\n", pTarget->Name, pLink->LinkObjectName);
  46. }
  47. return ERROR_GEN_FAILURE;
  48. }
  49. DFSSTATUS
  50. VerifyLink(
  51. PLINK_DEF pLink)
  52. {
  53. DFSSTATUS Status = ERROR_SUCCESS;
  54. DFSSTATUS TargetStatus = ERROR_SUCCESS;
  55. PTARGET_DEF pTarget;
  56. if (IsObjectInScript(pLink) && IsObjectInNameSpace(pLink))
  57. {
  58. for (pTarget = pLink->LinkObjectTargets; pTarget != NULL; pTarget = pTarget->NextTarget)
  59. {
  60. TargetStatus = VerifyTarget(pLink, pTarget);
  61. if (TargetStatus != ERROR_SUCCESS)
  62. {
  63. Status = ERROR_GEN_FAILURE;
  64. }
  65. }
  66. }
  67. else if (IsObjectInScript(pLink))
  68. {
  69. printf("Link %wS is not in the namespace, %wS\n", pLink->LinkObjectName);
  70. DumpLink(pLink);
  71. Status = ERROR_GEN_FAILURE;
  72. }
  73. else if (IsObjectInNameSpace(pLink))
  74. {
  75. printf("Link %wS is additional in namespace %wS \n",pLink->LinkObjectName);
  76. DumpLink(pLink);
  77. Status = ERROR_GEN_FAILURE;
  78. }
  79. else
  80. {
  81. printf("Script error for Link %wS \n", pLink->LinkObjectName);
  82. DumpLink(pLink);
  83. Status = ERROR_GEN_FAILURE;
  84. }
  85. return Status;
  86. }