Print this page
1575 untangle libmlrpc ... (smbsrv)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/smbsrv/libmlsvc/common/dssetup_clnt.c
+++ new/usr/src/lib/smbsrv/libmlsvc/common/dssetup_clnt.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
22 22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 25
26 26 /*
27 27 * Client side for the DSSETUP RPC service.
28 28 */
29 29
30 30 #include <string.h>
31 31 #include <strings.h>
32 -#include <smbsrv/wintypes.h>
32 +#include <smb/wintypes.h>
33 33 #include <smbsrv/libsmb.h>
34 34 #include <smbsrv/ndl/dssetup.ndl>
35 35 #include <smbsrv/libmlsvc.h>
36 36
37 37 int
38 38 dssetup_get_domain_info(ds_primary_domain_info_t *ds_info)
39 39 {
40 40 dssetup_DsRoleGetPrimaryDomainInfo_t arg;
41 41 struct dssetup_DsRolePrimaryDomInfo1 *info;
42 42 smb_domainex_t di;
43 43 mlsvc_handle_t handle;
44 44 int opnum;
45 45 int rc;
46 46
47 47 if (!smb_domain_getinfo(&di))
48 48 return (-1);
49 49
50 50 if (ndr_rpc_bind(&handle, di.d_dci.dc_name, di.d_primary.di_nbname,
51 51 MLSVC_ANON_USER, "DSSETUP") != 0)
52 52 return (-1);
53 53
54 54 opnum = DSSETUP_OPNUM_DsRoleGetPrimaryDomainInfo;
55 55 bzero(&arg, sizeof (dssetup_DsRoleGetPrimaryDomainInfo_t));
56 56 arg.level = DS_ROLE_BASIC_INFORMATION;
57 57
58 58 rc = ndr_rpc_call(&handle, opnum, &arg);
59 59 if ((rc != 0) || (arg.status != 0) || arg.info == NULL) {
60 60 ndr_rpc_unbind(&handle);
61 61 return (-1);
62 62 }
63 63
64 64 info = &arg.info->ru.info1;
65 65
66 66 if (info->nt_domain == NULL ||
67 67 info->dns_domain == NULL ||
68 68 info->forest == NULL) {
69 69 ndr_rpc_unbind(&handle);
70 70 return (-1);
71 71 }
72 72
73 73 bcopy(info, ds_info, sizeof (ds_primary_domain_info_t));
74 74 ds_info->nt_domain = (uint8_t *)strdup((char *)info->nt_domain);
75 75 ds_info->dns_domain = (uint8_t *)strdup((char *)info->dns_domain);
76 76 ds_info->forest = (uint8_t *)strdup((char *)info->forest);
77 77
78 78 ndr_rpc_unbind(&handle);
79 79 return (0);
80 80 }
81 81
82 82 /*
83 83 * Check whether our connection to the DC is working.
84 84 */
85 85 int
86 86 dssetup_check_service(void)
87 87 {
88 88 ds_primary_domain_info_t ds_info;
89 89 int rc;
90 90
91 91 bzero(&ds_info, sizeof (ds_info));
92 92
93 93 if ((rc = dssetup_get_domain_info(&ds_info)) == 0) {
94 94 free(ds_info.nt_domain);
95 95 free(ds_info.dns_domain);
96 96 free(ds_info.forest);
97 97 }
98 98
99 99 return (rc);
100 100 }
↓ open down ↓ |
58 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX