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