winbind: change nested structure initialization syntax
[ddiss/samba.git] / source3 / winbindd / winbindd_domain.c
1 /*
2    Unix SMB/CIFS implementation.
3
4    Winbind domain child functions
5
6    Copyright (C) Stefan Metzmacher 2007
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #include "includes.h"
23 #include "winbindd.h"
24
25 #undef DBGC_CLASS
26 #define DBGC_CLASS DBGC_WINBIND
27
28 static const struct winbindd_child_dispatch_table domain_dispatch_table[] = {
29         {
30                 .name           = "PING",
31                 .struct_cmd     = WINBINDD_PING,
32                 .type           = WINBINDD_CHILD_DISPATCH_SYNC,
33                 {
34                         .sync = {
35                                 .struct_fn = winbindd_dual_ping,
36                         },
37                 },
38
39         },{
40                 .name           = "LIST_TRUSTDOM",
41                 .struct_cmd     = WINBINDD_LIST_TRUSTDOM,
42                 .type           = WINBINDD_CHILD_DISPATCH_SYNC,
43                 {
44                         .sync = {
45                                 .struct_fn = winbindd_dual_list_trusted_domains,
46                         },
47                 },
48
49         },{
50                 .name           = "INIT_CONNECTION",
51                 .struct_cmd     = WINBINDD_INIT_CONNECTION,
52                 .type           = WINBINDD_CHILD_DISPATCH_SYNC,
53                 {
54                         .sync = {
55                                 .struct_fn = winbindd_dual_init_connection,
56                         },
57                 },
58
59         },{
60                 .name           = "PAM_AUTH",
61                 .struct_cmd     = WINBINDD_PAM_AUTH,
62                 .type           = WINBINDD_CHILD_DISPATCH_SYNC,
63                 {
64                         .sync = {
65                                 .struct_fn = winbindd_dual_pam_auth,
66                         },
67                 },
68
69         },{
70                 .name           = "AUTH_CRAP",
71                 .struct_cmd     = WINBINDD_PAM_AUTH_CRAP,
72                 .type           = WINBINDD_CHILD_DISPATCH_SYNC,
73                 {
74                         .sync = {
75                                 .struct_fn = winbindd_dual_pam_auth_crap,
76                         },
77                 },
78
79         },{
80                 .name           = "PAM_LOGOFF",
81                 .struct_cmd     = WINBINDD_PAM_LOGOFF,
82                 .type           = WINBINDD_CHILD_DISPATCH_SYNC,
83                 {
84                         .sync = {
85                                 .struct_fn = winbindd_dual_pam_logoff,
86                         },
87                 },
88
89         },{
90                 .name           = "CHNG_PSWD_AUTH_CRAP",
91                 .struct_cmd     = WINBINDD_PAM_CHNG_PSWD_AUTH_CRAP,
92                 .type           = WINBINDD_CHILD_DISPATCH_SYNC,
93                 {
94                         .sync = {
95                                 .struct_fn = winbindd_dual_pam_chng_pswd_auth_crap,
96                         },
97                 },
98
99         },{
100                 .name           = "PAM_CHAUTHTOK",
101                 .struct_cmd     = WINBINDD_PAM_CHAUTHTOK,
102                 .type           = WINBINDD_CHILD_DISPATCH_SYNC,
103                 {
104                         .sync = {
105                                 .struct_fn = winbindd_dual_pam_chauthtok,
106                         },
107                 },
108
109         },{
110                 .name           = "NDRCMD",
111                 .struct_cmd     = WINBINDD_DUAL_NDRCMD,
112                 .type           = WINBINDD_CHILD_DISPATCH_ASYNC,
113                 {
114                         .async = {
115                                 .struct_fn_send = winbindd_dual_ndrcmd_send,
116                                 .struct_fn_recv = winbindd_dual_ndrcmd_recv,
117                         },
118                 },
119         },{
120                 .name           = NULL,
121         }
122 };
123
124 void setup_domain_child(struct winbindd_domain *domain)
125 {
126         int i;
127
128         for (i=0; i<lp_winbind_max_domain_connections(); i++) {
129                 setup_child(domain, &domain->children[i],
130                             domain_dispatch_table,
131                             "log.wb", domain->name);
132                 domain->children[i].domain = domain;
133         }
134 }