xref: /titanic_51/usr/src/lib/krb5/kadm5/clnt/client_rpc.c (revision 1e49577a7fcde812700ded04431b49d67cc57d6d)
1 /*
2  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 
7 /*
8  * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
9  *
10  *	Openvision retains the copyright to derivative works of
11  *	this source code.  Do *NOT* create a derivative of this
12  *	source code before consulting with your legal department.
13  *	Do *NOT* integrate *ANY* of this source code into another
14  *	product before consulting with your legal department.
15  *
16  *	For further information, read the top-level Openvision
17  *	copyright which is contained in the top-level MIT Kerberos
18  *	copyright.
19  *
20  * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
21  *
22  */
23 
24 
25 #include <rpc/rpc.h> /* SUNWresync121 XXX */
26 #include <kadm5/kadm_rpc.h>
27 #include <krb5.h>
28 #include <kadm5/admin.h>
29 #ifdef HAVE_MEMORY_H
30 #include <memory.h>
31 #endif
32 
33 /* Default timeout can be changed using clnt_control() */
34 static struct timeval TIMEOUT = { 25, 0 };
35 
36 generic_ret *
37 create_principal_2(cprinc_arg *argp, CLIENT *clnt)
38 {
39 	static generic_ret clnt_res;
40 
41 	/* Solaris Kerberos */
42 	if (clnt == NULL)
43 		return (NULL);
44 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
45 	if (clnt_call(clnt, CREATE_PRINCIPAL,
46 		      (xdrproc_t) xdr_cprinc_arg, (caddr_t) argp,
47 		      (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
48 		      TIMEOUT) != RPC_SUCCESS) {
49 		return (NULL);
50 	}
51 	return (&clnt_res);
52 }
53 
54 generic_ret *
55 create_principal3_2(cprinc3_arg *argp, CLIENT *clnt)
56 {
57 	static generic_ret clnt_res;
58 
59 	/* Solaris Kerberos */
60 	if (clnt == NULL)
61 		return (NULL);
62 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
63 	if (clnt_call(clnt, CREATE_PRINCIPAL3,
64 		      (xdrproc_t) xdr_cprinc3_arg, (caddr_t) argp,
65 		      (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
66 		      TIMEOUT) != RPC_SUCCESS) {
67 		return (NULL);
68 	}
69 	return (&clnt_res);
70 }
71 
72 generic_ret *
73 delete_principal_2(dprinc_arg *argp, CLIENT *clnt)
74 {
75 	static generic_ret clnt_res;
76 
77 	/* Solaris Kerberos */
78 	if (clnt == NULL)
79 		return (NULL);
80 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
81 	if (clnt_call(clnt, DELETE_PRINCIPAL,
82 		      (xdrproc_t) xdr_dprinc_arg, (caddr_t) argp,
83 		      (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
84 		      TIMEOUT) != RPC_SUCCESS) {
85 		return (NULL);
86 	}
87 	return (&clnt_res);
88 }
89 
90 generic_ret *
91 modify_principal_2(mprinc_arg *argp, CLIENT *clnt)
92 {
93 	static generic_ret clnt_res;
94 
95 	/* Solaris Kerberos */
96 	if (clnt == NULL)
97 		return (NULL);
98 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
99 	if (clnt_call(clnt, MODIFY_PRINCIPAL,
100 		      (xdrproc_t) xdr_mprinc_arg, (caddr_t) argp,
101 		      (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
102 		      TIMEOUT) != RPC_SUCCESS) {
103 		return (NULL);
104 	}
105 	return (&clnt_res);
106 }
107 
108 generic_ret *
109 rename_principal_2(rprinc_arg *argp, CLIENT *clnt)
110 {
111 	static generic_ret clnt_res;
112 
113 	/* Solaris Kerberos */
114 	if (clnt == NULL)
115 		return (NULL);
116 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
117 	if (clnt_call(clnt, RENAME_PRINCIPAL,
118 		      (xdrproc_t) xdr_rprinc_arg, (caddr_t) argp,
119 		      (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
120 		      TIMEOUT) != RPC_SUCCESS) {
121 		return (NULL);
122 	}
123 	return (&clnt_res);
124 }
125 
126 gprinc_ret *
127 get_principal_2(gprinc_arg *argp, CLIENT *clnt)
128 {
129 	static gprinc_ret clnt_res;
130 
131 	/* Solaris Kerberos */
132 	if (clnt == NULL)
133 		return (NULL);
134 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
135 	if (clnt_call(clnt, GET_PRINCIPAL,
136 		      (xdrproc_t) xdr_gprinc_arg, (caddr_t) argp,
137 		      (xdrproc_t) xdr_gprinc_ret, (caddr_t) &clnt_res,
138 		      TIMEOUT) != RPC_SUCCESS) {
139 		return (NULL);
140 	}
141 	return (&clnt_res);
142 }
143 
144 gprincs_ret *
145 get_princs_2(gprincs_arg *argp, CLIENT *clnt)
146 {
147 	static gprincs_ret clnt_res;
148 
149 	/* Solaris Kerberos */
150 	if (clnt == NULL)
151 		return (NULL);
152 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
153 	if (clnt_call(clnt, GET_PRINCS,
154 		      (xdrproc_t) xdr_gprincs_arg, (caddr_t) argp,
155 		      (xdrproc_t) xdr_gprincs_ret, (caddr_t) &clnt_res,
156 		      TIMEOUT) != RPC_SUCCESS) {
157 	     return (NULL);
158 	}
159 	return (&clnt_res);
160 }
161 
162 generic_ret *
163 chpass_principal_2(chpass_arg *argp, CLIENT *clnt)
164 {
165 	static generic_ret clnt_res;
166 
167 	/* Solaris Kerberos */
168 	if (clnt == NULL)
169 		return (NULL);
170 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
171 	if (clnt_call(clnt, CHPASS_PRINCIPAL,
172 		      (xdrproc_t) xdr_chpass_arg, (caddr_t) argp,
173 		      (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
174 		      TIMEOUT) != RPC_SUCCESS) {
175 		return (NULL);
176 	}
177 	return (&clnt_res);
178 }
179 
180 generic_ret *
181 chpass_principal3_2(chpass3_arg *argp, CLIENT *clnt)
182 {
183 	static generic_ret clnt_res;
184 
185 	/* Solaris Kerberos */
186 	if (clnt == NULL)
187 		return (NULL);
188 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
189 	if (clnt_call(clnt, CHPASS_PRINCIPAL3,
190 		      (xdrproc_t) xdr_chpass3_arg, (caddr_t) argp,
191 		      (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
192 		      TIMEOUT) != RPC_SUCCESS) {
193 		return (NULL);
194 	}
195 	return (&clnt_res);
196 }
197 
198 generic_ret *
199 setv4key_principal_2(setv4key_arg *argp, CLIENT *clnt)
200 {
201 	static generic_ret clnt_res;
202 
203 	/* Solaris Kerberos */
204 	if (clnt == NULL)
205 		return (NULL);
206 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
207 	if (clnt_call(clnt, SETV4KEY_PRINCIPAL,
208 		      (xdrproc_t) xdr_setv4key_arg, (caddr_t) argp,
209 		      (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
210 		      TIMEOUT) != RPC_SUCCESS) {
211 		return (NULL);
212 	}
213 	return (&clnt_res);
214 }
215 
216 generic_ret *
217 setkey_principal_2(setkey_arg *argp, CLIENT *clnt)
218 {
219 	static generic_ret clnt_res;
220 
221 	/* Solaris Kerberos */
222 	if (clnt == NULL)
223 		return (NULL);
224 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
225 	if (clnt_call(clnt, SETKEY_PRINCIPAL,
226 		      (xdrproc_t) xdr_setkey_arg, (caddr_t) argp,
227 		      (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
228 		      TIMEOUT) != RPC_SUCCESS) {
229 		return (NULL);
230 	}
231 	return (&clnt_res);
232 }
233 
234 generic_ret *
235 setkey_principal3_2(setkey3_arg *argp, CLIENT *clnt)
236 {
237 	static generic_ret clnt_res;
238 
239 	/* Solaris Kerberos */
240 	if (clnt == NULL)
241 		return (NULL);
242 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
243 	if (clnt_call(clnt, SETKEY_PRINCIPAL3,
244 		      (xdrproc_t) xdr_setkey3_arg, (caddr_t) argp,
245 		      (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
246 		      TIMEOUT) != RPC_SUCCESS) {
247 		return (NULL);
248 	}
249 	return (&clnt_res);
250 }
251 
252 chrand_ret *
253 chrand_principal_2(chrand_arg *argp, CLIENT *clnt)
254 {
255 	static chrand_ret clnt_res;
256 
257 	/* Solaris Kerberos */
258 	if (clnt == NULL)
259 		return (NULL);
260 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
261 	if (clnt_call(clnt, CHRAND_PRINCIPAL,
262 		      (xdrproc_t) xdr_chrand_arg, (caddr_t) argp,
263 		      (xdrproc_t) xdr_chrand_ret, (caddr_t) &clnt_res,
264 		      TIMEOUT) != RPC_SUCCESS) {
265 		return (NULL);
266 	}
267 	return (&clnt_res);
268 }
269 
270 chrand_ret *
271 chrand_principal3_2(chrand3_arg *argp, CLIENT *clnt)
272 {
273 	static chrand_ret clnt_res;
274 
275 	/* Solaris Kerberos */
276 	if (clnt == NULL)
277 		return (NULL);
278 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
279 	if (clnt_call(clnt, CHRAND_PRINCIPAL3,
280 		      (xdrproc_t) xdr_chrand3_arg, (caddr_t) argp,
281 		      (xdrproc_t) xdr_chrand_ret, (caddr_t) &clnt_res,
282 		      TIMEOUT) != RPC_SUCCESS) {
283 		return (NULL);
284 	}
285 	return (&clnt_res);
286 }
287 
288 generic_ret *
289 create_policy_2(cpol_arg *argp, CLIENT *clnt)
290 {
291 	static generic_ret clnt_res;
292 
293 	/* Solaris Kerberos */
294 	if (clnt == NULL)
295 		return (NULL);
296 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
297 	if (clnt_call(clnt, CREATE_POLICY,
298 		      (xdrproc_t) xdr_cpol_arg, (caddr_t) argp,
299 		      (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
300 		      TIMEOUT) != RPC_SUCCESS) {
301 		return (NULL);
302 	}
303 	return (&clnt_res);
304 }
305 
306 generic_ret *
307 delete_policy_2(dpol_arg *argp, CLIENT *clnt)
308 {
309 	static generic_ret clnt_res;
310 
311 	/* Solaris Kerberos */
312 	if (clnt == NULL)
313 		return (NULL);
314 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
315 	if (clnt_call(clnt, DELETE_POLICY,
316 		      (xdrproc_t) xdr_dpol_arg, (caddr_t) argp,
317 		      (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
318 		      TIMEOUT) != RPC_SUCCESS) {
319 		return (NULL);
320 	}
321 	return (&clnt_res);
322 }
323 
324 generic_ret *
325 modify_policy_2(mpol_arg *argp, CLIENT *clnt)
326 {
327 	static generic_ret clnt_res;
328 
329 	/* Solaris Kerberos */
330 	if (clnt == NULL)
331 		return (NULL);
332 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
333 	if (clnt_call(clnt, MODIFY_POLICY,
334 		      (xdrproc_t) xdr_mpol_arg, (caddr_t) argp,
335 		      (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
336 		      TIMEOUT) != RPC_SUCCESS) {
337 		return (NULL);
338 	}
339 	return (&clnt_res);
340 }
341 
342 gpol_ret *
343 get_policy_2(gpol_arg *argp, CLIENT *clnt)
344 {
345 	static gpol_ret clnt_res;
346 
347 	/* Solaris Kerberos */
348 	if (clnt == NULL)
349 		return (NULL);
350 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
351 	if (clnt_call(clnt, GET_POLICY,
352 		      (xdrproc_t) xdr_gpol_arg, (caddr_t) argp,
353 		      (xdrproc_t) xdr_gpol_ret, (caddr_t) &clnt_res,
354 		      TIMEOUT) != RPC_SUCCESS) {
355 		return (NULL);
356 	}
357 	return (&clnt_res);
358 }
359 
360 gpols_ret *
361 get_pols_2(gpols_arg *argp, CLIENT *clnt)
362 {
363 	static gpols_ret clnt_res;
364 
365 	/* Solaris Kerberos */
366 	if (clnt == NULL)
367 		return (NULL);
368 	memset((char *)&clnt_res, 0, sizeof(clnt_res));
369 	if (clnt_call(clnt, GET_POLS,
370 		      (xdrproc_t) xdr_gpols_arg, (caddr_t) argp,
371 		      (xdrproc_t) xdr_gpols_ret, (caddr_t) &clnt_res,
372 		      TIMEOUT) != RPC_SUCCESS) {
373 	     return (NULL);
374 	}
375 	return (&clnt_res);
376 }
377 
378 getprivs_ret *
379 get_privs_2(void *argp, CLIENT *clnt)
380 {
381      static getprivs_ret clnt_res;
382 
383 	/* Solaris Kerberos */
384 	if (clnt == NULL)
385 		return (NULL);
386      memset((char *)&clnt_res, 0, sizeof(clnt_res));
387      if (clnt_call(clnt, GET_PRIVS,
388 		   (xdrproc_t) xdr_u_int, (caddr_t) argp,
389 		   (xdrproc_t) xdr_getprivs_ret, (caddr_t) &clnt_res,
390 		   TIMEOUT) != RPC_SUCCESS) {
391 	  return (NULL);
392      }
393      return (&clnt_res);
394 }
395 
396 generic_ret *
397 init_2(void *argp, CLIENT *clnt)
398 {
399      static generic_ret clnt_res;
400 
401 	/* Solaris Kerberos */
402      if (clnt == NULL)
403          return (NULL);
404 
405      memset((char *)&clnt_res, 0, sizeof(clnt_res));
406      if (clnt_call(clnt, INIT,
407 		   (xdrproc_t) xdr_u_int, (caddr_t) argp,
408 		   (xdrproc_t) xdr_generic_ret, (caddr_t) &clnt_res,
409 		   TIMEOUT) != RPC_SUCCESS) {
410 	  return (NULL);
411      }
412      return (&clnt_res);
413 }
414