2 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
8 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
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.
16 * For further information, read the top-level Openvision
17 * copyright which is contained in the top-level MIT Kerberos
20 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
26 * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved
31 static char *rcsid
= "$Header$";
33 #include <rpc/rpc.h> /* SUNWresync121 XXX */
34 #include <kadm5/admin.h>
35 #include <kadm5/kadm_rpc.h>
36 #include "client_internal.h"
42 kadm5_create_policy(void *server_handle
,
43 kadm5_policy_ent_t policy
, long mask
)
47 kadm5_server_handle_t handle
= server_handle
;
49 CHECK_HANDLE(server_handle
);
51 if(policy
== (kadm5_policy_ent_t
) NULL
)
55 arg
.api_version
= handle
->api_version
;
56 memcpy(&arg
.rec
, policy
, sizeof(kadm5_policy_ent_rec
));
57 r
= create_policy_2(&arg
, handle
->clnt
);
59 return KADM5_RPC_ERROR
;
65 kadm5_delete_policy(void *server_handle
, char *name
)
69 kadm5_server_handle_t handle
= server_handle
;
71 CHECK_HANDLE(server_handle
);
77 arg
.api_version
= handle
->api_version
;
79 r
= delete_policy_2(&arg
, handle
->clnt
);
81 return KADM5_RPC_ERROR
;
87 kadm5_modify_policy(void *server_handle
,
88 kadm5_policy_ent_t policy
, long mask
)
92 kadm5_server_handle_t handle
= server_handle
;
94 CHECK_HANDLE(server_handle
);
96 if(policy
== (kadm5_policy_ent_t
) NULL
)
100 arg
.api_version
= handle
->api_version
;
102 memcpy(&arg
.rec
, policy
, sizeof(kadm5_policy_ent_rec
));
103 r
= modify_policy_2(&arg
, handle
->clnt
);
105 return KADM5_RPC_ERROR
;
111 kadm5_get_policy(void *server_handle
, char *name
, kadm5_policy_ent_t ent
)
115 kadm5_server_handle_t handle
= server_handle
;
117 CHECK_HANDLE(server_handle
);
120 arg
.api_version
= handle
->api_version
;
125 r
= get_policy_2(&arg
, handle
->clnt
);
127 return KADM5_RPC_ERROR
;
128 if (handle
->api_version
== KADM5_API_VERSION_1
) {
129 kadm5_policy_ent_t
*entp
;
131 entp
= (kadm5_policy_ent_t
*) ent
;
133 if (!(*entp
= (kadm5_policy_ent_t
)
134 malloc(sizeof(kadm5_policy_ent_rec
))))
136 memcpy(*entp
, &r
->rec
, sizeof(**entp
));
142 memcpy(ent
, &r
->rec
, sizeof(r
->rec
));
149 kadm5_get_policies(void *server_handle
,
150 char *exp
, char ***pols
, int *count
)
154 kadm5_server_handle_t handle
= server_handle
;
156 CHECK_HANDLE(server_handle
);
158 if(pols
== NULL
|| count
== NULL
)
161 arg
.api_version
= handle
->api_version
;
162 r
= get_pols_2(&arg
, handle
->clnt
);
164 return KADM5_RPC_ERROR
;