xref: /titanic_50/usr/src/cmd/krb5/kwarn/kwarnd_clnt_stubs.c (revision 080575042aba2197b425ebfd52061dea061a9aa1)
1 /*
2  * Copyright (c) 1998,1999, by Sun Microsystems, Inc.
3  * All rights reserved.
4  */
5 
6 #pragma ident	"%Z%%M%	%I%	%E% SMI"
7 
8 /*
9  *  stub module for kwarnd.
10  */
11 
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include "kwarnd.h"
15 #include <rpc/rpc.h>
16 
17 #include <sys/types.h>
18 #include <sys/devops.h>
19 #include <sys/open.h>
20 #include <sys/stat.h>
21 #include <sys/conf.h>
22 #include <sys/ddi.h>
23 #include <sys/sunddi.h>
24 #include <sys/uio.h>
25 
26 CLIENT  *clnt, *getkwarnd_handle(void);
27 char *server = "localhost";
28 
29 OM_UINT32
30 kwarn_add_warning(WARNING_NAME_T warning_name, int cred_exp_time)
31 {
32 	kwarn_add_warning_arg args;
33 	kwarn_add_warning_res res;
34 
35 	/* check the input/output parameters */
36 	if (warning_name == NULL || cred_exp_time == 0)
37 		return (1);
38 
39 	/* get the client handle to kwarnd */
40 	if ((clnt = getkwarnd_handle()) == NULL) {
41 		clnt_pcreateerror(server);
42 		return (1);
43 	}
44 
45 	/* set the rpc parameters */
46 	args.cred_exp_time = cred_exp_time;
47 	args.warning_name = warning_name;
48 
49 	/* call the remote procedure */
50 	memset(&res, 0, sizeof (res));
51 	if (kwarn_add_warning_1(&args, &res, clnt) != RPC_SUCCESS) {
52 		return (1);
53 	}
54 
55 	/* nothing to free */
56 
57 	return (res.status);
58 }
59 
60 OM_UINT32
61 kwarn_del_warning(WARNING_NAME_T warning_name)
62 {
63 	kwarn_del_warning_arg args;
64 	kwarn_del_warning_res res;
65 
66 
67 	/* check the output parameters */
68 	if (warning_name == NULL)
69 		return (1);
70 
71 	/* get the client GSSD handle */
72 	if ((clnt = getkwarnd_handle()) == NULL) {
73 		clnt_pcreateerror(server);
74 		return (1);
75 	}
76 
77 	/* set the input parameters */
78 	args.warning_name = warning_name;
79 
80 	/* call the remote procedure */
81 	memset(&res, 0, sizeof (res));
82 	if (kwarn_del_warning_1(&args, &res, clnt) != RPC_SUCCESS) {
83 		return (1);
84 	}
85 
86 	/* nothing to free */
87 
88 	return (res.status);
89 }
90