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 #if !defined(lint) && !defined(__CODECENTER__)
32 static char *rcsid
= "$Header$";
35 #include <rpc/rpc.h> /* SUNWresync121 XXX */
36 #include <kadm5/admin.h>
37 #include <kadm5/kadm_rpc.h>
38 #include "client_internal.h"
44 kadm5_create_policy(void *server_handle
,
45 kadm5_policy_ent_t policy
, long mask
)
49 kadm5_server_handle_t handle
= server_handle
;
51 CHECK_HANDLE(server_handle
);
53 if(policy
== (kadm5_policy_ent_t
) NULL
)
57 arg
.api_version
= handle
->api_version
;
58 memcpy(&arg
.rec
, policy
, sizeof(kadm5_policy_ent_rec
));
59 r
= create_policy_2(&arg
, handle
->clnt
);
61 return KADM5_RPC_ERROR
;
67 kadm5_delete_policy(void *server_handle
, char *name
)
71 kadm5_server_handle_t handle
= server_handle
;
73 CHECK_HANDLE(server_handle
);
79 arg
.api_version
= handle
->api_version
;
81 r
= delete_policy_2(&arg
, handle
->clnt
);
83 return KADM5_RPC_ERROR
;
89 kadm5_modify_policy(void *server_handle
,
90 kadm5_policy_ent_t policy
, long mask
)
94 kadm5_server_handle_t handle
= server_handle
;
96 CHECK_HANDLE(server_handle
);
98 if(policy
== (kadm5_policy_ent_t
) NULL
)
102 arg
.api_version
= handle
->api_version
;
104 memcpy(&arg
.rec
, policy
, sizeof(kadm5_policy_ent_rec
));
105 r
= modify_policy_2(&arg
, handle
->clnt
);
107 return KADM5_RPC_ERROR
;
113 kadm5_get_policy(void *server_handle
, char *name
, kadm5_policy_ent_t ent
)
117 kadm5_server_handle_t handle
= server_handle
;
119 CHECK_HANDLE(server_handle
);
122 arg
.api_version
= handle
->api_version
;
127 r
= get_policy_2(&arg
, handle
->clnt
);
129 return KADM5_RPC_ERROR
;
130 if (handle
->api_version
== KADM5_API_VERSION_1
) {
131 kadm5_policy_ent_t
*entp
;
133 entp
= (kadm5_policy_ent_t
*) ent
;
135 if (!(*entp
= (kadm5_policy_ent_t
)
136 malloc(sizeof(kadm5_policy_ent_rec
))))
138 memcpy(*entp
, &r
->rec
, sizeof(**entp
));
144 memcpy(ent
, &r
->rec
, sizeof(r
->rec
));
151 kadm5_get_policies(void *server_handle
,
152 char *exp
, char ***pols
, int *count
)
156 kadm5_server_handle_t handle
= server_handle
;
158 CHECK_HANDLE(server_handle
);
160 if(pols
== NULL
|| count
== NULL
)
163 arg
.api_version
= handle
->api_version
;
164 r
= get_pols_2(&arg
, handle
->clnt
);
166 return KADM5_RPC_ERROR
;