Print this page
1575 untangle libmlrpc ... pre1:
Move srvsvc_timecheck where it belongs
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_init.c
+++ new/usr/src/lib/smbsrv/libmlsvc/common/mlsvc_init.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 /*
22 22 * Copyright (c) 2007, 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 #include <sys/errno.h>
27 27 #include <sys/tzfile.h>
28 28 #include <stdlib.h>
29 29 #include <unistd.h>
30 30 #include <strings.h>
31 31 #include <string.h>
32 32 #include <rpc/xdr.h>
33 33 #include <synch.h>
34 34 #include <pthread.h>
35 35 #include <smbsrv/libsmb.h>
36 36 #include <smbsrv/libmlsvc.h>
37 37 #include <mlsvc.h>
38 38
39 39 static void *mlsvc_timecheck(void *);
40 40
41 41 #define MLSVC_TIMECHECK_INTERVAL (10 * SECSPERMIN) /* 10 minutes */
42 42
43 43 /*
44 44 * All NDR RPC service initialization is invoked from here.
45 45 * Returns 0 upon success. Otherwise, returns -1.
46 46 */
47 47 int
48 48 mlsvc_init(void)
49 49 {
50 50 pthread_t tid;
51 51 pthread_attr_t tattr;
52 52 int rc;
53 53
54 54 smb_proc_initsem();
55 55
56 56 if (smb_logon_init() != NT_STATUS_SUCCESS)
57 57 return (-1);
58 58
59 59 if ((rc = smb_dclocator_init()) != 0)
60 60 return (rc);
61 61
62 62 smb_quota_init();
63 63 smbrdr_initialize();
64 64 srvsvc_initialize();
65 65 wkssvc_initialize();
66 66 lsarpc_initialize();
67 67 netr_initialize();
68 68 dssetup_initialize();
69 69 samr_initialize();
70 70 svcctl_initialize();
71 71 winreg_initialize();
72 72 logr_initialize();
73 73 msgsvcsend_initialize();
74 74 spoolss_initialize();
75 75 netdfs_initialize();
76 76
77 77 (void) pthread_attr_init(&tattr);
78 78 (void) pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
79 79 rc = pthread_create(&tid, &tattr, mlsvc_timecheck, 0);
80 80 (void) pthread_attr_destroy(&tattr);
81 81 return (rc);
82 82 }
83 83
84 84 void
85 85 mlsvc_fini(void)
86 86 {
87 87 smb_logon_fini();
88 88 spoolss_finalize();
89 89 svcctl_finalize();
90 90 logr_finalize();
91 91 netdfs_finalize();
92 92 smb_quota_fini();
93 93 }
94 94
95 95 /*ARGSUSED*/
96 96 static void *
97 97 mlsvc_timecheck(void *arg)
98 98 {
99 99 smb_domainex_t di;
100 100
101 101 for (;;) {
102 102 (void) sleep(MLSVC_TIMECHECK_INTERVAL);
103 103
↓ open down ↓ |
103 lines elided |
↑ open up ↑ |
104 104 if (smb_config_get_secmode() != SMB_SECMODE_DOMAIN)
105 105 continue;
106 106
107 107 /* Avoid interfering with DC discovery. */
108 108 if (smb_ddiscover_wait() != 0)
109 109 continue;
110 110
111 111 if (!smb_domain_getinfo(&di))
112 112 continue;
113 113
114 - ndr_srvsvc_timecheck(di.d_dci.dc_name,
114 + srvsvc_timecheck(di.d_dci.dc_name,
115 115 di.d_primary.di_nbname);
116 116 }
117 117
118 118 /*NOTREACHED*/
119 119 return (NULL);
120 120 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX