dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / krb5 / kwarn / kwarnd_clnt_stubs.c
blob55d6ad4b772f45b9ab97e59e577680384a5f8b0d
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 * stub module for kwarnd.
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include "kwarnd.h"
34 #include <rpc/rpc.h>
36 #include <sys/types.h>
37 #include <sys/devops.h>
38 #include <sys/open.h>
39 #include <sys/stat.h>
40 #include <sys/conf.h>
41 #include <sys/ddi.h>
42 #include <sys/sunddi.h>
43 #include <sys/uio.h>
44 #include <syslog.h>
46 extern CLIENT *getkwarnd_handle(void);
47 extern void resetkwarnd_handle(void);
49 OM_UINT32
50 kwarn_add_warning(WARNING_NAME_T warning_name, int cred_exp_time)
52 kwarn_add_warning_arg args;
53 kwarn_add_warning_res res;
54 enum clnt_stat ret;
55 boolean_t first = TRUE;
56 CLIENT *clnt;
58 /* check the input/output parameters */
59 if (warning_name == NULL || cred_exp_time == 0)
60 return (1);
62 rebind:
63 /* get the client handle to kwarnd */
64 if ((clnt = getkwarnd_handle()) == NULL) {
66 * Let app output if an error occurs but we'll syslog to
67 * DEBUG to get error details if needed.
69 syslog(LOG_DEBUG, "%s",
70 clnt_spcreateerror("getkwarnd_handle"));
71 return (1);
74 /* set the rpc parameters */
75 args.cred_exp_time = cred_exp_time;
76 args.warning_name = warning_name;
78 /* call the remote procedure */
79 memset(&res, 0, sizeof (res));
80 ret = kwarn_add_warning_1(&args, &res, clnt);
81 if (ret != RPC_SUCCESS) {
83 * Could have timed out due to the process restarting for
84 * various reasons. Should attempt to rebind in the case
85 * process is actually running.
87 if (ret == RPC_TIMEDOUT && first) {
88 resetkwarnd_handle();
89 first = FALSE;
90 goto rebind;
92 return (1);
95 /* nothing to free */
97 return (res.status);
100 OM_UINT32
101 kwarn_del_warning(WARNING_NAME_T warning_name)
103 kwarn_del_warning_arg args;
104 kwarn_del_warning_res res;
105 enum clnt_stat ret;
106 boolean_t first = TRUE;
107 CLIENT *clnt;
109 /* check the output parameters */
110 if (warning_name == NULL)
111 return (1);
113 rebind:
114 /* get the client GSSD handle */
115 if ((clnt = getkwarnd_handle()) == NULL) {
117 * Let app output if an error occurs but we'll syslog to
118 * DEBUG to get error details if needed.
120 syslog(LOG_DEBUG, "%s",
121 clnt_spcreateerror("getkwarnd_handle"));
122 return (1);
125 /* set the input parameters */
126 args.warning_name = warning_name;
128 /* call the remote procedure */
129 memset(&res, 0, sizeof (res));
130 ret = kwarn_del_warning_1(&args, &res, clnt);
131 if (ret != RPC_SUCCESS) {
133 * Could have timed out due to the process restarting for
134 * various reasons. Should attempt to rebind in the case
135 * process is actually running.
137 if (ret == RPC_TIMEDOUT && first) {
138 resetkwarnd_handle();
139 first = FALSE;
140 goto rebind;
142 return (1);
145 /* nothing to free */
147 return (res.status);