2
0

280-strip_srvsvc.patch 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. --- a/source3/smbd/lanman.c
  2. +++ b/source3/smbd/lanman.c
  3. @@ -2197,6 +2197,10 @@ static bool api_RNetShareAdd(struct smbd
  4. struct srvsvc_NetShareInfo2 info2;
  5. struct dcerpc_binding_handle *b;
  6. +#ifndef SRVSVC_SUPPORT
  7. + return False;
  8. +#endif
  9. +
  10. if (!str1 || !str2 || !p) {
  11. return False;
  12. }
  13. @@ -3589,10 +3593,7 @@ static bool api_RNetServerGetInfo(struct
  14. NTSTATUS status;
  15. WERROR werr;
  16. TALLOC_CTX *mem_ctx = talloc_tos();
  17. - struct rpc_pipe_client *cli = NULL;
  18. - union srvsvc_NetSrvInfo info;
  19. int errcode;
  20. - struct dcerpc_binding_handle *b;
  21. if (!str1 || !str2 || !p) {
  22. return False;
  23. @@ -3655,66 +3656,16 @@ static bool api_RNetServerGetInfo(struct
  24. p = *rdata;
  25. p2 = p + struct_len;
  26. - status = rpc_pipe_open_interface(mem_ctx, &ndr_table_srvsvc.syntax_id,
  27. - conn->session_info,
  28. - &conn->sconn->client_id,
  29. - conn->sconn->msg_ctx,
  30. - &cli);
  31. - if (!NT_STATUS_IS_OK(status)) {
  32. - DEBUG(0,("api_RNetServerGetInfo: could not connect to srvsvc: %s\n",
  33. - nt_errstr(status)));
  34. - errcode = W_ERROR_V(ntstatus_to_werror(status));
  35. - goto out;
  36. - }
  37. -
  38. - b = cli->binding_handle;
  39. -
  40. - status = dcerpc_srvsvc_NetSrvGetInfo(b, mem_ctx,
  41. - NULL,
  42. - 101,
  43. - &info,
  44. - &werr);
  45. - if (!NT_STATUS_IS_OK(status)) {
  46. - errcode = W_ERROR_V(ntstatus_to_werror(status));
  47. - goto out;
  48. - }
  49. - if (!W_ERROR_IS_OK(werr)) {
  50. - errcode = W_ERROR_V(werr);
  51. - goto out;
  52. - }
  53. -
  54. - if (info.info101 == NULL) {
  55. - errcode = W_ERROR_V(WERR_INVALID_PARAM);
  56. - goto out;
  57. - }
  58. -
  59. if (uLevel != 20) {
  60. - srvstr_push(NULL, 0, p, info.info101->server_name, 16,
  61. + srvstr_push(NULL, 0, p, global_myname(), 16,
  62. STR_ASCII|STR_UPPER|STR_TERMINATE);
  63. - }
  64. + }
  65. p += 16;
  66. if (uLevel > 0) {
  67. - SCVAL(p,0,info.info101->version_major);
  68. - SCVAL(p,1,info.info101->version_minor);
  69. - SIVAL(p,2,info.info101->server_type);
  70. -
  71. - if (mdrcnt == struct_len) {
  72. - SIVAL(p,6,0);
  73. - } else {
  74. - SIVAL(p,6,PTR_DIFF(p2,*rdata));
  75. - if (mdrcnt - struct_len <= 0) {
  76. - return false;
  77. - }
  78. - push_ascii(p2,
  79. - info.info101->comment,
  80. - MIN(mdrcnt - struct_len,
  81. - MAX_SERVER_STRING_LENGTH),
  82. - STR_TERMINATE);
  83. - p2 = skip_string(*rdata,*rdata_len,p2);
  84. - if (!p2) {
  85. - return False;
  86. - }
  87. - }
  88. + SCVAL(p,0,lp_major_announce_version());
  89. + SCVAL(p,1,lp_minor_announce_version());
  90. + SIVAL(p,2,lp_default_server_announce());
  91. + SIVAL(p,6,0);
  92. }
  93. if (uLevel > 1) {
  94. @@ -5405,6 +5356,10 @@ static bool api_RNetSessionEnum(struct s
  95. uint32_t totalentries, resume_handle = 0;
  96. uint32_t count = 0;
  97. +#ifndef SRVSVC_SUPPORT
  98. + return False;
  99. +#endif
  100. +
  101. if (!str1 || !str2 || !p) {
  102. return False;
  103. }
  104. --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
  105. +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
  106. @@ -1533,6 +1533,10 @@ WERROR _srvsvc_NetShareSetInfo(struct pi
  107. TALLOC_CTX *ctx = p->mem_ctx;
  108. union srvsvc_NetShareInfo *info = r->in.info;
  109. +#ifndef FULL_SRVSVC
  110. + return WERR_ACCESS_DENIED;
  111. +#endif
  112. +
  113. DEBUG(5,("_srvsvc_NetShareSetInfo: %d\n", __LINE__));
  114. if (!r->in.share_name) {
  115. @@ -1763,6 +1767,10 @@ WERROR _srvsvc_NetShareAdd(struct pipes_
  116. int max_connections = 0;
  117. TALLOC_CTX *ctx = p->mem_ctx;
  118. +#ifndef FULL_SRVSVC
  119. + return WERR_ACCESS_DENIED;
  120. +#endif
  121. +
  122. DEBUG(5,("_srvsvc_NetShareAdd: %d\n", __LINE__));
  123. if (r->out.parm_error) {
  124. @@ -1945,6 +1953,10 @@ WERROR _srvsvc_NetShareDel(struct pipes_
  125. struct share_params *params;
  126. TALLOC_CTX *ctx = p->mem_ctx;
  127. +#ifndef FULL_SRVSVC
  128. + return WERR_ACCESS_DENIED;
  129. +#endif
  130. +
  131. DEBUG(5,("_srvsvc_NetShareDel: %d\n", __LINE__));
  132. if (!r->in.share_name) {