xref: /illumos-gate/usr/src/lib/libnisdb/yptol/stubs.c (revision d48be21240dfd051b689384ce2b23479d757f2d8)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * DESCRIPTION:	The N2L system is dependent on a number of utility functions
29  *		supplied by NIS object code (under cmd/ypcmd). When libnisdb
30  *		is loaded by executable other than those built under
31  *		cmd/ypcmd (e.g. the NIS+ executables) these would be
32  *		undefined. To prevent this happening the stubs in this file
33  *		contain weak definitions on these functions. In the NIS case
34  *		these weak definitions will be overridden by the real ones.
35  *
36  *		The functions in this file will never be called. NIS will have
37  *		overridden them and nothing else should call yptol. If they are
38  *		called then there is a bug in the build system.
39  *
40  *		Note : This is not elegant but it is a way of dealing with
41  *		preexisting code structure.
42  */
43 
44 #include <unistd.h>
45 #include <syslog.h>
46 #include <sys/mman.h>
47 #include <thread.h>
48 #include <synch.h>
49 #include <ndbm.h>
50 #include "ypsym.h"
51 #include "shim.h"
52 #include "../ldap_util.h"
53 
54 
55 /*
56  * FUNCTION :	disaster()
57  *
58  * DESCRIPTION:	Called if the stubs is accidentally called.
59  */
60 void
61 disaster()
62 {
63 	logmsg(MSG_NOTIMECHECK, LOG_ERR, "YPTOL stub called. This indicates"
64 						" a serious build error");
65 }
66 
67 #pragma weak lock_core
68 int
69 lock_core(int hashval)
70 {
71 	disaster();
72 	return (0);
73 }
74 
75 #pragma weak unlock_core
76 int
77 unlock_core(int hashval)
78 {
79 	disaster();
80 	return (0);
81 }
82 
83 #pragma weak lock_map
84 int
85 lock_map(char *mapname)
86 {
87 	disaster();
88 	return (0);
89 }
90 
91 #pragma weak unlock_map
92 int
93 unlock_map(char *mapname)
94 {
95 	disaster();
96 	return (0);
97 }
98 
99 #pragma weak init_lock_map
100 bool
101 init_lock_map()
102 {
103 	disaster();
104 	return (FALSE);
105 }
106 
107 #pragma weak hash
108 int
109 hash(char *s)
110 {
111 	disaster();
112 	return (0);
113 }
114 
115 #pragma weak rename_map
116 bool
117 rename_map(char *from, char *to, bool_t secure_map)
118 {
119 	disaster();
120 	return (FALSE);
121 }
122 
123 #pragma weak delete_map
124 bool
125 delete_map(char *name)
126 {
127 	disaster();
128 	return (FALSE);
129 }
130 
131 #pragma weak single
132 #pragma weak nogecos
133 #pragma weak noshell
134 #pragma weak nopw
135 #pragma weak mflag
136 int single, nogecos, noshell, nopw, mflag;
137 
138 #pragma weak validloginshell
139 bool_t
140 validloginshell(char *sh, char *arg, int priv)
141 {
142 	disaster();
143 	return (0);
144 }
145 
146 #pragma weak validstr
147 int
148 validstr(char *str, size_t size)
149 {
150 	disaster();
151 	return (0);
152 }
153