Improve the Gemand pam_winbind translation.
[Samba/nascimento.git] / source3 / rpc_server / srv_ntsvcs.c
blob5010990b587c04b647e45a6643cac53acbf3d741
1 /*
2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Gerald Carter 2005.
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.
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.
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/>.
20 #include "includes.h"
21 #include "librpc/gen_ndr/srv_ntsvcs.h"
23 #undef DBGC_CLASS
24 #define DBGC_CLASS DBGC_RPC_SRV
26 /*******************************************************************
27 ********************************************************************/
29 static bool proxy_ntsvcs_call(pipes_struct *p, uint8_t opnum)
31 struct api_struct *fns;
32 int n_fns;
34 ntsvcs_get_pipe_fns(&fns, &n_fns);
36 if (opnum >= n_fns) {
37 return false;
40 if (fns[opnum].opnum != opnum) {
41 smb_panic("NTSVCS function table not sorted");
44 return fns[opnum].fn(p);
47 /*******************************************************************
48 ********************************************************************/
50 static bool api_ntsvcs_get_version(pipes_struct *p)
52 return proxy_ntsvcs_call(p, NDR_PNP_GETVERSION);
55 /*******************************************************************
56 ********************************************************************/
58 static bool api_ntsvcs_get_device_list_size(pipes_struct *p)
60 return proxy_ntsvcs_call(p, NDR_PNP_GETDEVICELISTSIZE);
63 /*******************************************************************
64 ********************************************************************/
66 static bool api_ntsvcs_get_device_list(pipes_struct *p)
68 NTSVCS_Q_GET_DEVICE_LIST q_u;
69 NTSVCS_R_GET_DEVICE_LIST r_u;
70 prs_struct *data = &p->in_data.data;
71 prs_struct *rdata = &p->out_data.rdata;
73 ZERO_STRUCT(q_u);
74 ZERO_STRUCT(r_u);
76 if(!ntsvcs_io_q_get_device_list("", &q_u, data, 0))
77 return False;
79 r_u.status = _ntsvcs_get_device_list(p, &q_u, &r_u);
81 if(!ntsvcs_io_r_get_device_list("", &r_u, rdata, 0))
82 return False;
84 return True;
87 /*******************************************************************
88 ********************************************************************/
90 static bool api_ntsvcs_validate_device_instance(pipes_struct *p)
92 return proxy_ntsvcs_call(p, NDR_PNP_VALIDATEDEVICEINSTANCE);
95 /*******************************************************************
96 ********************************************************************/
98 static bool api_ntsvcs_get_device_reg_property(pipes_struct *p)
100 NTSVCS_Q_GET_DEVICE_REG_PROPERTY q_u;
101 NTSVCS_R_GET_DEVICE_REG_PROPERTY r_u;
102 prs_struct *data = &p->in_data.data;
103 prs_struct *rdata = &p->out_data.rdata;
105 ZERO_STRUCT(q_u);
106 ZERO_STRUCT(r_u);
108 if(!ntsvcs_io_q_get_device_reg_property("", &q_u, data, 0))
109 return False;
111 r_u.status = _ntsvcs_get_device_reg_property(p, &q_u, &r_u);
113 if(!ntsvcs_io_r_get_device_reg_property("", &r_u, rdata, 0))
114 return False;
116 return True;
119 /*******************************************************************
120 ********************************************************************/
122 static bool api_ntsvcs_get_hw_profile_info(pipes_struct *p)
124 return proxy_ntsvcs_call(p, NDR_PNP_GETHWPROFINFO);
127 /*******************************************************************
128 ********************************************************************/
130 static bool api_ntsvcs_hw_profile_flags(pipes_struct *p)
132 return proxy_ntsvcs_call(p, NDR_PNP_HWPROFFLAGS);
135 /*******************************************************************
136 \PIPE\svcctl commands
137 ********************************************************************/
139 static struct api_struct api_ntsvcs_cmds[] =
141 { "NTSVCS_GET_VERSION" , NTSVCS_GET_VERSION , api_ntsvcs_get_version },
142 { "NTSVCS_GET_DEVICE_LIST_SIZE" , NTSVCS_GET_DEVICE_LIST_SIZE , api_ntsvcs_get_device_list_size },
143 { "NTSVCS_GET_DEVICE_LIST" , NTSVCS_GET_DEVICE_LIST , api_ntsvcs_get_device_list },
144 { "NTSVCS_VALIDATE_DEVICE_INSTANCE" , NTSVCS_VALIDATE_DEVICE_INSTANCE , api_ntsvcs_validate_device_instance },
145 { "NTSVCS_GET_DEVICE_REG_PROPERTY" , NTSVCS_GET_DEVICE_REG_PROPERTY , api_ntsvcs_get_device_reg_property },
146 { "NTSVCS_GET_HW_PROFILE_INFO" , NTSVCS_GET_HW_PROFILE_INFO , api_ntsvcs_get_hw_profile_info },
147 { "NTSVCS_HW_PROFILE_FLAGS" , NTSVCS_HW_PROFILE_FLAGS , api_ntsvcs_hw_profile_flags }
151 void ntsvcs2_get_pipe_fns( struct api_struct **fns, int *n_fns )
153 *fns = api_ntsvcs_cmds;
154 *n_fns = sizeof(api_ntsvcs_cmds) / sizeof(struct api_struct);
157 NTSTATUS rpc_ntsvcs2_init(void)
159 return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
160 "ntsvcs", "ntsvcs",
161 &ndr_table_ntsvcs.syntax_id,
162 api_ntsvcs_cmds,
163 sizeof(api_ntsvcs_cmds) / sizeof(struct api_struct));