Line data Source code
1 : /*
2 : * Unix SMB/CIFS implementation.
3 : * NetApi Server Support
4 : * Copyright (C) Guenther Deschner 2007
5 : *
6 : * This program is free software; you can redistribute it and/or modify
7 : * it under the terms of the GNU General Public License as published by
8 : * the Free Software Foundation; either version 3 of the License, or
9 : * (at your option) any later version.
10 : *
11 : * This program is distributed in the hope that it will be useful,
12 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : * GNU General Public License for more details.
15 : *
16 : * You should have received a copy of the GNU General Public License
17 : * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 : */
19 :
20 : #include "includes.h"
21 :
22 : #include "librpc/gen_ndr/libnetapi.h"
23 : #include "lib/netapi/netapi.h"
24 : #include "lib/netapi/netapi_private.h"
25 : #include "lib/netapi/libnetapi.h"
26 : #include "../librpc/gen_ndr/ndr_srvsvc_c.h"
27 : #include "lib/smbconf/smbconf.h"
28 : #include "lib/smbconf/smbconf_reg.h"
29 : #include "libsmb/dsgetdcname.h"
30 :
31 : /****************************************************************
32 : ****************************************************************/
33 :
34 0 : static WERROR NetServerGetInfo_l_101(struct libnetapi_ctx *ctx,
35 : uint8_t **buffer)
36 : {
37 0 : const struct loadparm_substitution *lp_sub =
38 0 : loadparm_s3_global_substitution();
39 0 : struct SERVER_INFO_101 i;
40 :
41 0 : i.sv101_platform_id = PLATFORM_ID_NT;
42 0 : i.sv101_name = lp_netbios_name();
43 0 : i.sv101_version_major = SAMBA_MAJOR_NBT_ANNOUNCE_VERSION;
44 0 : i.sv101_version_minor = SAMBA_MINOR_NBT_ANNOUNCE_VERSION;
45 0 : i.sv101_type = lp_default_server_announce();
46 0 : i.sv101_comment = lp_server_string(ctx, lp_sub);
47 :
48 0 : *buffer = (uint8_t *)talloc_memdup(ctx, &i, sizeof(i));
49 0 : if (!*buffer) {
50 0 : return WERR_NOT_ENOUGH_MEMORY;
51 : }
52 :
53 0 : return WERR_OK;
54 : }
55 :
56 : /****************************************************************
57 : ****************************************************************/
58 :
59 0 : static WERROR NetServerGetInfo_l_1005(struct libnetapi_ctx *ctx,
60 : uint8_t **buffer)
61 : {
62 0 : const struct loadparm_substitution *lp_sub =
63 0 : loadparm_s3_global_substitution();
64 0 : struct SERVER_INFO_1005 info1005;
65 :
66 0 : info1005.sv1005_comment = lp_server_string(ctx, lp_sub);
67 0 : *buffer = (uint8_t *)talloc_memdup(ctx, &info1005, sizeof(info1005));
68 0 : if (!*buffer) {
69 0 : return WERR_NOT_ENOUGH_MEMORY;
70 : }
71 :
72 0 : return WERR_OK;
73 : }
74 :
75 : /****************************************************************
76 : ****************************************************************/
77 :
78 0 : WERROR NetServerGetInfo_l(struct libnetapi_ctx *ctx,
79 : struct NetServerGetInfo *r)
80 : {
81 0 : switch (r->in.level) {
82 0 : case 101:
83 0 : return NetServerGetInfo_l_101(ctx, r->out.buffer);
84 0 : case 1005:
85 0 : return NetServerGetInfo_l_1005(ctx, r->out.buffer);
86 0 : default:
87 0 : break;
88 : }
89 :
90 0 : return WERR_INVALID_LEVEL;
91 : }
92 :
93 : /****************************************************************
94 : ****************************************************************/
95 :
96 0 : static NTSTATUS map_server_info_to_SERVER_INFO_buffer(TALLOC_CTX *mem_ctx,
97 : uint32_t level,
98 : union srvsvc_NetSrvInfo *i,
99 : uint8_t **buffer)
100 : {
101 0 : struct SERVER_INFO_100 i100;
102 0 : struct SERVER_INFO_101 i101;
103 0 : struct SERVER_INFO_102 i102;
104 0 : struct SERVER_INFO_402 i402;
105 0 : struct SERVER_INFO_403 i403;
106 0 : struct SERVER_INFO_502 i502;
107 0 : struct SERVER_INFO_503 i503;
108 0 : struct SERVER_INFO_599 i599;
109 0 : struct SERVER_INFO_1005 i1005;
110 : #if 0
111 : struct SERVER_INFO_1010 i1010;
112 : struct SERVER_INFO_1016 i1016;
113 : struct SERVER_INFO_1017 i1017;
114 : struct SERVER_INFO_1018 i1018;
115 : struct SERVER_INFO_1107 i1107;
116 : struct SERVER_INFO_1501 i1501;
117 : struct SERVER_INFO_1502 i1502;
118 : struct SERVER_INFO_1503 i1503;
119 : struct SERVER_INFO_1506 i1506;
120 : struct SERVER_INFO_1509 i1509;
121 : struct SERVER_INFO_1510 i1510;
122 : struct SERVER_INFO_1511 i1511;
123 : struct SERVER_INFO_1512 i1512;
124 : struct SERVER_INFO_1513 i1513;
125 : struct SERVER_INFO_1514 i1514;
126 : struct SERVER_INFO_1515 i1515;
127 : struct SERVER_INFO_1516 i1516;
128 : struct SERVER_INFO_1518 i1518;
129 : struct SERVER_INFO_1520 i1520;
130 : struct SERVER_INFO_1521 i1521;
131 : struct SERVER_INFO_1522 i1522;
132 : struct SERVER_INFO_1523 i1523;
133 : struct SERVER_INFO_1524 i1524;
134 : struct SERVER_INFO_1525 i1525;
135 : struct SERVER_INFO_1528 i1528;
136 : struct SERVER_INFO_1529 i1529;
137 : struct SERVER_INFO_1530 i1530;
138 : struct SERVER_INFO_1533 i1533;
139 : struct SERVER_INFO_1534 i1534;
140 : struct SERVER_INFO_1535 i1535;
141 : struct SERVER_INFO_1536 i1536;
142 : struct SERVER_INFO_1537 i1537;
143 : struct SERVER_INFO_1538 i1538;
144 : struct SERVER_INFO_1539 i1539;
145 : struct SERVER_INFO_1540 i1540;
146 : struct SERVER_INFO_1541 i1541;
147 : struct SERVER_INFO_1542 i1542;
148 : struct SERVER_INFO_1543 i1543;
149 : struct SERVER_INFO_1544 i1544;
150 : struct SERVER_INFO_1545 i1545;
151 : struct SERVER_INFO_1546 i1546;
152 : struct SERVER_INFO_1547 i1547;
153 : struct SERVER_INFO_1548 i1548;
154 : struct SERVER_INFO_1549 i1549;
155 : struct SERVER_INFO_1550 i1550;
156 : struct SERVER_INFO_1552 i1552;
157 : struct SERVER_INFO_1553 i1553;
158 : struct SERVER_INFO_1554 i1554;
159 : struct SERVER_INFO_1555 i1555;
160 : struct SERVER_INFO_1556 i1556;
161 : struct SERVER_INFO_1557 i1557;
162 : struct SERVER_INFO_1560 i1560;
163 : struct SERVER_INFO_1561 i1561;
164 : struct SERVER_INFO_1562 i1562;
165 : struct SERVER_INFO_1563 i1563;
166 : struct SERVER_INFO_1564 i1564;
167 : struct SERVER_INFO_1565 i1565;
168 : struct SERVER_INFO_1566 i1566;
169 : struct SERVER_INFO_1567 i1567;
170 : struct SERVER_INFO_1568 i1568;
171 : struct SERVER_INFO_1569 i1569;
172 : struct SERVER_INFO_1570 i1570;
173 : struct SERVER_INFO_1571 i1571;
174 : struct SERVER_INFO_1572 i1572;
175 : struct SERVER_INFO_1573 i1573;
176 : struct SERVER_INFO_1574 i1574;
177 : struct SERVER_INFO_1575 i1575;
178 : struct SERVER_INFO_1576 i1576;
179 : struct SERVER_INFO_1577 i1577;
180 : struct SERVER_INFO_1578 i1578;
181 : struct SERVER_INFO_1579 i1579;
182 : struct SERVER_INFO_1580 i1580;
183 : struct SERVER_INFO_1581 i1581;
184 : struct SERVER_INFO_1582 i1582;
185 : struct SERVER_INFO_1583 i1583;
186 : struct SERVER_INFO_1584 i1584;
187 : struct SERVER_INFO_1585 i1585;
188 : struct SERVER_INFO_1586 i1586;
189 : struct SERVER_INFO_1587 i1587;
190 : struct SERVER_INFO_1588 i1588;
191 : struct SERVER_INFO_1590 i1590;
192 : struct SERVER_INFO_1591 i1591;
193 : struct SERVER_INFO_1592 i1592;
194 : struct SERVER_INFO_1593 i1593;
195 : struct SERVER_INFO_1594 i1594;
196 : struct SERVER_INFO_1595 i1595;
197 : struct SERVER_INFO_1596 i1596;
198 : struct SERVER_INFO_1597 i1597;
199 : struct SERVER_INFO_1598 i1598;
200 : struct SERVER_INFO_1599 i1599;
201 : struct SERVER_INFO_1600 i1600;
202 : struct SERVER_INFO_1601 i1601;
203 : struct SERVER_INFO_1602 i1602;
204 : #endif
205 0 : uint32_t num_info = 0;
206 :
207 0 : switch (level) {
208 0 : case 100:
209 0 : i100.sv100_platform_id = i->info100->platform_id;
210 0 : i100.sv100_name = talloc_strdup(mem_ctx, i->info100->server_name);
211 :
212 0 : ADD_TO_ARRAY(mem_ctx, struct SERVER_INFO_100, i100,
213 : (struct SERVER_INFO_100 **)buffer,
214 : &num_info);
215 0 : break;
216 :
217 0 : case 101:
218 0 : i101.sv101_platform_id = i->info101->platform_id;
219 0 : i101.sv101_name = talloc_strdup(mem_ctx, i->info101->server_name);
220 0 : i101.sv101_version_major = i->info101->version_major;
221 0 : i101.sv101_version_minor = i->info101->version_minor;
222 0 : i101.sv101_type = i->info101->server_type;
223 0 : i101.sv101_comment = talloc_strdup(mem_ctx, i->info101->comment);
224 :
225 0 : ADD_TO_ARRAY(mem_ctx, struct SERVER_INFO_101, i101,
226 : (struct SERVER_INFO_101 **)buffer,
227 : &num_info);
228 0 : break;
229 :
230 0 : case 102:
231 0 : i102.sv102_platform_id = i->info102->platform_id;
232 0 : i102.sv102_name = talloc_strdup(mem_ctx, i->info102->server_name);
233 0 : i102.sv102_version_major = i->info102->version_major;
234 0 : i102.sv102_version_minor = i->info102->version_minor;
235 0 : i102.sv102_type = i->info102->server_type;
236 0 : i102.sv102_comment = talloc_strdup(mem_ctx, i->info102->comment);
237 0 : i102.sv102_users = i->info102->users;
238 0 : i102.sv102_disc = i->info102->disc;
239 0 : i102.sv102_hidden = i->info102->hidden;
240 0 : i102.sv102_announce = i->info102->announce;
241 0 : i102.sv102_anndelta = i->info102->anndelta;
242 0 : i102.sv102_licenses = i->info102->licenses;
243 0 : i102.sv102_userpath = talloc_strdup(mem_ctx, i->info102->userpath);
244 :
245 0 : ADD_TO_ARRAY(mem_ctx, struct SERVER_INFO_102, i102,
246 : (struct SERVER_INFO_102 **)buffer,
247 : &num_info);
248 0 : break;
249 :
250 0 : case 402:
251 :
252 0 : i402.sv402_ulist_mtime = i->info402->ulist_mtime;
253 0 : i402.sv402_glist_mtime = i->info402->glist_mtime;
254 0 : i402.sv402_alist_mtime = i->info402->alist_mtime;
255 0 : i402.sv402_alerts = talloc_strdup(mem_ctx, i->info402->alerts);
256 0 : i402.sv402_security = i->info402->security;
257 0 : i402.sv402_numadmin = i->info402->numadmin;
258 0 : i402.sv402_lanmask = i->info402->lanmask;
259 0 : i402.sv402_guestacct = talloc_strdup(mem_ctx, i->info402->guestaccount);
260 0 : i402.sv402_chdevs = i->info402->chdevs;
261 0 : i402.sv402_chdevq = i->info402->chdevqs;
262 0 : i402.sv402_chdevjobs = i->info402->chdevjobs;
263 0 : i402.sv402_connections = i->info402->connections;
264 0 : i402.sv402_shares = i->info402->shares;
265 0 : i402.sv402_openfiles = i->info402->openfiles;
266 0 : i402.sv402_sessopens = i->info402->sessopen;
267 0 : i402.sv402_sessvcs = i->info402->sesssvc;
268 0 : i402.sv402_sessreqs = i->info402->sessreqs;
269 0 : i402.sv402_opensearch = i->info402->opensearch;
270 0 : i402.sv402_activelocks = i->info402->activelocks;
271 0 : i402.sv402_numreqbuf = i->info402->numreqbufs;
272 0 : i402.sv402_sizreqbuf = i->info402->sizereqbufs;
273 0 : i402.sv402_numbigbuf = i->info402->numbigbufs;
274 0 : i402.sv402_numfiletasks = i->info402->numfiletasks;
275 0 : i402.sv402_alertsched = i->info402->alertsched;
276 0 : i402.sv402_erroralert = i->info402->erroralert;
277 0 : i402.sv402_logonalert = i->info402->logonalert;
278 0 : i402.sv402_accessalert = i->info402->accessalert;
279 0 : i402.sv402_diskalert = i->info402->diskalert;
280 0 : i402.sv402_netioalert = i->info402->netioalert;
281 0 : i402.sv402_maxauditsz = i->info402->maxaudits;
282 0 : i402.sv402_srvheuristics = i->info402->srvheuristics;
283 :
284 0 : ADD_TO_ARRAY(mem_ctx, struct SERVER_INFO_402, i402,
285 : (struct SERVER_INFO_402 **)buffer,
286 : &num_info);
287 0 : break;
288 :
289 0 : case 403:
290 :
291 0 : i403.sv403_ulist_mtime = i->info403->ulist_mtime;
292 0 : i403.sv403_glist_mtime = i->info403->glist_mtime;
293 0 : i403.sv403_alist_mtime = i->info403->alist_mtime;
294 0 : i403.sv403_alerts = talloc_strdup(mem_ctx, i->info403->alerts);
295 0 : i403.sv403_security = i->info403->security;
296 0 : i403.sv403_numadmin = i->info403->numadmin;
297 0 : i403.sv403_lanmask = i->info403->lanmask;
298 0 : i403.sv403_guestacct = talloc_strdup(mem_ctx, i->info403->guestaccount);
299 0 : i403.sv403_chdevs = i->info403->chdevs;
300 0 : i403.sv403_chdevq = i->info403->chdevqs;
301 0 : i403.sv403_chdevjobs = i->info403->chdevjobs;
302 0 : i403.sv403_connections = i->info403->connections;
303 0 : i403.sv403_shares = i->info403->shares;
304 0 : i403.sv403_openfiles = i->info403->openfiles;
305 0 : i403.sv403_sessopens = i->info403->sessopen;
306 0 : i403.sv403_sessvcs = i->info403->sesssvc;
307 0 : i403.sv403_sessreqs = i->info403->sessreqs;
308 0 : i403.sv403_opensearch = i->info403->opensearch;
309 0 : i403.sv403_activelocks = i->info403->activelocks;
310 0 : i403.sv403_numreqbuf = i->info403->numreqbufs;
311 0 : i403.sv403_sizreqbuf = i->info403->sizereqbufs;
312 0 : i403.sv403_numbigbuf = i->info403->numbigbufs;
313 0 : i403.sv403_numfiletasks = i->info403->numfiletasks;
314 0 : i403.sv403_alertsched = i->info403->alertsched;
315 0 : i403.sv403_erroralert = i->info403->erroralert;
316 0 : i403.sv403_logonalert = i->info403->logonalert;
317 0 : i403.sv403_accessalert = i->info403->accessalert;
318 0 : i403.sv403_diskalert = i->info403->diskalert;
319 0 : i403.sv403_netioalert = i->info403->netioalert;
320 0 : i403.sv403_maxauditsz = i->info403->maxaudits;
321 0 : i403.sv403_srvheuristics = i->info403->srvheuristics;
322 0 : i403.sv403_auditedevents = i->info403->auditedevents;
323 0 : i403.sv403_autoprofile = i->info403->auditprofile;
324 0 : i403.sv403_autopath = talloc_strdup(mem_ctx, i->info403->autopath);
325 :
326 0 : ADD_TO_ARRAY(mem_ctx, struct SERVER_INFO_403, i403,
327 : (struct SERVER_INFO_403 **)buffer,
328 : &num_info);
329 0 : break;
330 :
331 0 : case 502:
332 0 : i502.sv502_sessopens = i->info502->sessopen;
333 0 : i502.sv502_sessvcs = i->info502->sesssvc;
334 0 : i502.sv502_opensearch = i->info502->opensearch;
335 0 : i502.sv502_sizreqbuf = i->info502->sizereqbufs;
336 0 : i502.sv502_initworkitems = i->info502->initworkitems;
337 0 : i502.sv502_maxworkitems = i->info502->maxworkitems;
338 0 : i502.sv502_rawworkitems = i->info502->rawworkitems;
339 0 : i502.sv502_irpstacksize = i->info502->irpstacksize;
340 0 : i502.sv502_maxrawbuflen = i->info502->maxrawbuflen;
341 0 : i502.sv502_sessusers = i->info502->sessusers;
342 0 : i502.sv502_sessconns = i->info502->sessconns;
343 0 : i502.sv502_maxpagedmemoryusage = i->info502->maxpagedmemoryusage;
344 0 : i502.sv502_maxnonpagedmemoryusage = i->info502->maxnonpagedmemoryusage;
345 0 : i502.sv502_enablesoftcompat = i->info502->enablesoftcompat;
346 0 : i502.sv502_enableforcedlogoff = i->info502->enableforcedlogoff;
347 0 : i502.sv502_timesource = i->info502->timesource;
348 0 : i502.sv502_acceptdownlevelapis = i->info502->acceptdownlevelapis;
349 0 : i502.sv502_lmannounce = i->info502->lmannounce;
350 :
351 0 : ADD_TO_ARRAY(mem_ctx, struct SERVER_INFO_502, i502,
352 : (struct SERVER_INFO_502 **)buffer,
353 : &num_info);
354 0 : break;
355 :
356 0 : case 503:
357 0 : i503.sv503_sessopens = i->info503->sessopen;
358 0 : i503.sv503_sessvcs = i->info503->sesssvc;
359 0 : i503.sv503_opensearch = i->info503->opensearch;
360 0 : i503.sv503_sizreqbuf = i->info503->sizereqbufs;
361 0 : i503.sv503_initworkitems = i->info503->initworkitems;
362 0 : i503.sv503_maxworkitems = i->info503->maxworkitems;
363 0 : i503.sv503_rawworkitems = i->info503->rawworkitems;
364 0 : i503.sv503_irpstacksize = i->info503->irpstacksize;
365 0 : i503.sv503_maxrawbuflen = i->info503->maxrawbuflen;
366 0 : i503.sv503_sessusers = i->info503->sessusers;
367 0 : i503.sv503_sessconns = i->info503->sessconns;
368 0 : i503.sv503_maxpagedmemoryusage = i->info503->maxpagedmemoryusage;
369 0 : i503.sv503_maxnonpagedmemoryusage = i->info503->maxnonpagedmemoryusage;
370 0 : i503.sv503_enablesoftcompat = i->info503->enablesoftcompat;
371 0 : i503.sv503_enableforcedlogoff = i->info503->enableforcedlogoff;
372 0 : i503.sv503_timesource = i->info503->timesource;
373 0 : i503.sv503_acceptdownlevelapis = i->info503->acceptdownlevelapis;
374 0 : i503.sv503_lmannounce = i->info503->lmannounce;
375 0 : i503.sv503_domain = talloc_strdup(mem_ctx, i->info503->domain);
376 0 : i503.sv503_maxcopyreadlen = i->info503->maxcopyreadlen;
377 0 : i503.sv503_maxcopywritelen = i->info503->maxcopywritelen;
378 0 : i503.sv503_minkeepsearch = i->info503->minkeepsearch;
379 0 : i503.sv503_maxkeepsearch = i->info503->maxkeepsearch;
380 0 : i503.sv503_minkeepcomplsearch = i->info503->minkeepcomplsearch;
381 0 : i503.sv503_maxkeepcomplsearch = i->info503->maxkeepcomplsearch;
382 0 : i503.sv503_threadcountadd = i->info503->threadcountadd;
383 0 : i503.sv503_numblockthreads = i->info503->numlockthreads;
384 0 : i503.sv503_scavtimeout = i->info503->scavtimeout;
385 0 : i503.sv503_minrcvqueue = i->info503->minrcvqueue;
386 0 : i503.sv503_minfreeworkitems = i->info503->minfreeworkitems;
387 0 : i503.sv503_xactmemsize = i->info503->xactmemsize;
388 0 : i503.sv503_threadpriority = i->info503->threadpriority;
389 0 : i503.sv503_maxmpxct = i->info503->maxmpxct;
390 0 : i503.sv503_oplockbreakwait = i->info503->oplockbreakwait;
391 0 : i503.sv503_oplockbreakresponsewait = i->info503->oplockbreakresponsewait;
392 0 : i503.sv503_enableoplocks = i->info503->enableoplocks;
393 0 : i503.sv503_enableoplockforceclose = i->info503->enableoplockforceclose;
394 0 : i503.sv503_enablefcbopens = i->info503->enablefcbopens;
395 0 : i503.sv503_enableraw = i->info503->enableraw;
396 0 : i503.sv503_enablesharednetdrives = i->info503->enablesharednetdrives;
397 0 : i503.sv503_minfreeconnections = i->info503->minfreeconnections;
398 0 : i503.sv503_maxfreeconnections = i->info503->maxfreeconnections;
399 :
400 0 : ADD_TO_ARRAY(mem_ctx, struct SERVER_INFO_503, i503,
401 : (struct SERVER_INFO_503 **)buffer,
402 : &num_info);
403 0 : break;
404 :
405 0 : case 599:
406 0 : i599.sv599_sessopens = i->info599->sessopen;
407 0 : i599.sv599_sessvcs = i->info599->sesssvc;
408 0 : i599.sv599_opensearch = i->info599->opensearch;
409 0 : i599.sv599_sizreqbuf = i->info599->sizereqbufs;
410 0 : i599.sv599_initworkitems = i->info599->initworkitems;
411 0 : i599.sv599_maxworkitems = i->info599->maxworkitems;
412 0 : i599.sv599_rawworkitems = i->info599->rawworkitems;
413 0 : i599.sv599_irpstacksize = i->info599->irpstacksize;
414 0 : i599.sv599_maxrawbuflen = i->info599->maxrawbuflen;
415 0 : i599.sv599_sessusers = i->info599->sessusers;
416 0 : i599.sv599_sessconns = i->info599->sessconns;
417 0 : i599.sv599_maxpagedmemoryusage = i->info599->maxpagedmemoryusage;
418 0 : i599.sv599_maxnonpagedmemoryusage = i->info599->maxnonpagedmemoryusage;
419 0 : i599.sv599_enablesoftcompat = i->info599->enablesoftcompat;
420 0 : i599.sv599_enableforcedlogoff = i->info599->enableforcedlogoff;
421 0 : i599.sv599_timesource = i->info599->timesource;
422 0 : i599.sv599_acceptdownlevelapis = i->info599->acceptdownlevelapis;
423 0 : i599.sv599_lmannounce = i->info599->lmannounce;
424 0 : i599.sv599_domain = talloc_strdup(mem_ctx, i->info599->domain);
425 0 : i599.sv599_maxcopyreadlen = i->info599->maxcopyreadlen;
426 0 : i599.sv599_maxcopywritelen = i->info599->maxcopywritelen;
427 0 : i599.sv599_minkeepsearch = i->info599->minkeepsearch;
428 0 : i599.sv599_maxkeepsearch = 0; /* ?? */
429 0 : i599.sv599_minkeepcomplsearch = i->info599->minkeepcomplsearch;
430 0 : i599.sv599_maxkeepcomplsearch = i->info599->maxkeepcomplsearch;
431 0 : i599.sv599_threadcountadd = i->info599->threadcountadd;
432 0 : i599.sv599_numblockthreads = i->info599->numlockthreads; /* typo ? */
433 0 : i599.sv599_scavtimeout = i->info599->scavtimeout;
434 0 : i599.sv599_minrcvqueue = i->info599->minrcvqueue;
435 0 : i599.sv599_minfreeworkitems = i->info599->minfreeworkitems;
436 0 : i599.sv599_xactmemsize = i->info599->xactmemsize;
437 0 : i599.sv599_threadpriority = i->info599->threadpriority;
438 0 : i599.sv599_maxmpxct = i->info599->maxmpxct;
439 0 : i599.sv599_oplockbreakwait = i->info599->oplockbreakwait;
440 0 : i599.sv599_oplockbreakresponsewait = i->info599->oplockbreakresponsewait;
441 0 : i599.sv599_enableoplocks = i->info599->enableoplocks;
442 0 : i599.sv599_enableoplockforceclose = i->info599->enableoplockforceclose;
443 0 : i599.sv599_enablefcbopens = i->info599->enablefcbopens;
444 0 : i599.sv599_enableraw = i->info599->enableraw;
445 0 : i599.sv599_enablesharednetdrives = i->info599->enablesharednetdrives;
446 0 : i599.sv599_minfreeconnections = i->info599->minfreeconnections;
447 0 : i599.sv599_maxfreeconnections = i->info599->maxfreeconnections;
448 0 : i599.sv599_initsesstable = i->info599->initsesstable;
449 0 : i599.sv599_initconntable = i->info599->initconntable;
450 0 : i599.sv599_initfiletable = i->info599->initfiletable;
451 0 : i599.sv599_initsearchtable = i->info599->initsearchtable;
452 0 : i599.sv599_alertschedule = i->info599->alertsched;
453 0 : i599.sv599_errorthreshold = i->info599->errortreshold;
454 0 : i599.sv599_networkerrorthreshold = i->info599->networkerrortreshold;
455 0 : i599.sv599_diskspacethreshold = i->info599->diskspacetreshold;
456 0 : i599.sv599_reserved = i->info599->reserved;
457 0 : i599.sv599_maxlinkdelay = i->info599->maxlinkdelay;
458 0 : i599.sv599_minlinkthroughput = i->info599->minlinkthroughput;
459 0 : i599.sv599_linkinfovalidtime = i->info599->linkinfovalidtime;
460 0 : i599.sv599_scavqosinfoupdatetime = i->info599->scavqosinfoupdatetime;
461 0 : i599.sv599_maxworkitemidletime = i->info599->maxworkitemidletime;
462 :
463 0 : ADD_TO_ARRAY(mem_ctx, struct SERVER_INFO_599, i599,
464 : (struct SERVER_INFO_599 **)buffer,
465 : &num_info);
466 0 : break;
467 :
468 0 : case 1005:
469 0 : i1005.sv1005_comment = talloc_strdup(mem_ctx, i->info1005->comment);
470 :
471 0 : ADD_TO_ARRAY(mem_ctx, struct SERVER_INFO_1005, i1005,
472 : (struct SERVER_INFO_1005 **)buffer,
473 : &num_info);
474 0 : break;
475 0 : default:
476 0 : return NT_STATUS_NOT_SUPPORTED;
477 : }
478 :
479 0 : return NT_STATUS_OK;
480 : }
481 :
482 : /****************************************************************
483 : ****************************************************************/
484 :
485 0 : WERROR NetServerGetInfo_r(struct libnetapi_ctx *ctx,
486 : struct NetServerGetInfo *r)
487 : {
488 0 : NTSTATUS status;
489 0 : WERROR werr;
490 0 : union srvsvc_NetSrvInfo info;
491 0 : struct dcerpc_binding_handle *b;
492 :
493 0 : if (!r->out.buffer) {
494 0 : return WERR_INVALID_PARAMETER;
495 : }
496 :
497 0 : switch (r->in.level) {
498 0 : case 100:
499 : case 101:
500 : case 102:
501 : case 402:
502 : case 502:
503 : case 503:
504 : case 1005:
505 0 : break;
506 0 : default:
507 0 : return WERR_INVALID_LEVEL;
508 : }
509 :
510 0 : werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
511 : &ndr_table_srvsvc,
512 : &b);
513 0 : if (!W_ERROR_IS_OK(werr)) {
514 0 : goto done;
515 : }
516 :
517 0 : status = dcerpc_srvsvc_NetSrvGetInfo(b, talloc_tos(),
518 : r->in.server_name,
519 : r->in.level,
520 : &info,
521 : &werr);
522 0 : if (!NT_STATUS_IS_OK(status)) {
523 0 : werr = ntstatus_to_werror(status);
524 0 : goto done;
525 : }
526 :
527 0 : if (!W_ERROR_IS_OK(werr)) {
528 0 : goto done;
529 : }
530 :
531 0 : status = map_server_info_to_SERVER_INFO_buffer(ctx, r->in.level, &info,
532 : r->out.buffer);
533 0 : if (!NT_STATUS_IS_OK(status)) {
534 0 : werr = ntstatus_to_werror(status);
535 0 : goto done;
536 : }
537 :
538 0 : done:
539 0 : return werr;
540 : }
541 :
542 : /****************************************************************
543 : ****************************************************************/
544 :
545 0 : static WERROR NetServerSetInfo_l_1005(struct libnetapi_ctx *ctx,
546 : struct NetServerSetInfo *r)
547 : {
548 0 : WERROR werr = WERR_OK;
549 0 : sbcErr err;
550 0 : struct smbconf_ctx *conf_ctx;
551 0 : struct srvsvc_NetSrvInfo1005 *info1005;
552 :
553 0 : if (!r->in.buffer) {
554 0 : *r->out.parm_error = 1005; /* sure here ? */
555 0 : return WERR_INVALID_PARAMETER;
556 : }
557 :
558 0 : info1005 = (struct srvsvc_NetSrvInfo1005 *)r->in.buffer;
559 :
560 0 : if (!info1005->comment) {
561 0 : *r->out.parm_error = 1005;
562 0 : return WERR_INVALID_PARAMETER;
563 : }
564 :
565 0 : if (!lp_config_backend_is_registry()) {
566 0 : libnetapi_set_error_string(ctx,
567 : "Configuration manipulation requested but not "
568 : "supported by backend");
569 0 : return WERR_NOT_SUPPORTED;
570 : }
571 :
572 0 : err = smbconf_init_reg(ctx, &conf_ctx, NULL);
573 0 : if (!SBC_ERROR_IS_OK(err)) {
574 0 : libnetapi_set_error_string(ctx,
575 : "Could not initialize backend: %s",
576 : sbcErrorString(err));
577 0 : werr = WERR_SERVICE_DOES_NOT_EXIST;
578 0 : goto done;
579 : }
580 :
581 0 : err = smbconf_set_global_parameter(conf_ctx, "server string",
582 : info1005->comment);
583 0 : if (!SBC_ERROR_IS_OK(err)) {
584 0 : libnetapi_set_error_string(ctx,
585 : "Could not set global parameter: %s",
586 : sbcErrorString(err));
587 0 : werr = WERR_SERVICE_DOES_NOT_EXIST;
588 0 : goto done;
589 : }
590 :
591 0 : done:
592 0 : smbconf_shutdown(conf_ctx);
593 0 : return werr;
594 : }
595 :
596 : /****************************************************************
597 : ****************************************************************/
598 :
599 0 : WERROR NetServerSetInfo_l(struct libnetapi_ctx *ctx,
600 : struct NetServerSetInfo *r)
601 : {
602 0 : switch (r->in.level) {
603 0 : case 1005:
604 0 : return NetServerSetInfo_l_1005(ctx, r);
605 0 : default:
606 0 : break;
607 : }
608 :
609 0 : return WERR_INVALID_LEVEL;
610 : }
611 :
612 : /****************************************************************
613 : ****************************************************************/
614 :
615 0 : WERROR NetServerSetInfo_r(struct libnetapi_ctx *ctx,
616 : struct NetServerSetInfo *r)
617 : {
618 0 : NTSTATUS status;
619 0 : WERROR werr;
620 0 : union srvsvc_NetSrvInfo info;
621 0 : struct dcerpc_binding_handle *b;
622 :
623 0 : werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
624 : &ndr_table_srvsvc,
625 : &b);
626 0 : if (!W_ERROR_IS_OK(werr)) {
627 0 : goto done;
628 : }
629 :
630 0 : switch (r->in.level) {
631 0 : case 1005:
632 0 : info.info1005 = (struct srvsvc_NetSrvInfo1005 *)r->in.buffer;
633 0 : break;
634 0 : default:
635 0 : werr = WERR_NOT_SUPPORTED;
636 0 : goto done;
637 : }
638 :
639 0 : status = dcerpc_srvsvc_NetSrvSetInfo(b, talloc_tos(),
640 : r->in.server_name,
641 : r->in.level,
642 : &info,
643 : r->out.parm_error,
644 : &werr);
645 0 : if (!NT_STATUS_IS_OK(status)) {
646 0 : werr = ntstatus_to_werror(status);
647 0 : goto done;
648 : }
649 :
650 0 : done:
651 0 : return werr;
652 : }
653 :
654 : /****************************************************************
655 : ****************************************************************/
656 :
657 11 : WERROR NetRemoteTOD_r(struct libnetapi_ctx *ctx,
658 : struct NetRemoteTOD *r)
659 : {
660 0 : NTSTATUS status;
661 0 : WERROR werr;
662 11 : struct srvsvc_NetRemoteTODInfo *info = NULL;
663 0 : struct dcerpc_binding_handle *b;
664 :
665 11 : werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
666 : &ndr_table_srvsvc,
667 : &b);
668 11 : if (!W_ERROR_IS_OK(werr)) {
669 0 : goto done;
670 : }
671 :
672 11 : status = dcerpc_srvsvc_NetRemoteTOD(b, talloc_tos(),
673 : r->in.server_name,
674 : &info,
675 : &werr);
676 11 : if (!NT_STATUS_IS_OK(status)) {
677 0 : werr = ntstatus_to_werror(status);
678 0 : goto done;
679 : }
680 :
681 11 : if (!W_ERROR_IS_OK(werr)) {
682 0 : goto done;
683 : }
684 :
685 11 : *r->out.buffer = (uint8_t *)talloc_memdup(ctx, info,
686 : sizeof(struct srvsvc_NetRemoteTODInfo));
687 11 : W_ERROR_HAVE_NO_MEMORY(*r->out.buffer);
688 :
689 11 : done:
690 11 : return werr;
691 : }
692 :
693 : /****************************************************************
694 : ****************************************************************/
695 :
696 0 : WERROR NetRemoteTOD_l(struct libnetapi_ctx *ctx,
697 : struct NetRemoteTOD *r)
698 : {
699 0 : LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetRemoteTOD);
700 : }
701 :
|