xref: /titanic_52/usr/src/lib/libnisdb/yptol/stubs.c (revision 9e39c5ba00a55fa05777cc94b148296af305e135)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
45 
46 #include <unistd.h>
47 #include <syslog.h>
48 #include <sys/mman.h>
49 #include <thread.h>
50 #include <synch.h>
51 #include <ndbm.h>
52 #include "ypsym.h"
53 #include "shim.h"
54 #include "../ldap_util.h"
55 
56 
57 /*
58  * FUNCTION :	disaster()
59  *
60  * DESCRIPTION:	Called if the stubs is accidentally called.
61  */
62 void
63 disaster()
64 {
65 	logmsg(MSG_NOTIMECHECK, LOG_ERR, "YPTOL stub called. This indicates"
66 						" a serious build error");
67 }
68 
69 #pragma weak lock_core
70 int
71 lock_core(int hashval)
72 {
73 	disaster();
74 	return (0);
75 }
76 
77 #pragma weak unlock_core
78 int
79 unlock_core(int hashval)
80 {
81 	disaster();
82 	return (0);
83 }
84 
85 #pragma weak lock_map
86 int
87 lock_map(char *mapname)
88 {
89 	disaster();
90 	return (0);
91 }
92 
93 #pragma weak unlock_map
94 int
95 unlock_map(char *mapname)
96 {
97 	disaster();
98 	return (0);
99 }
100 
101 #pragma weak init_lock_map
102 bool
103 init_lock_map()
104 {
105 	disaster();
106 	return (FALSE);
107 }
108 
109 #pragma weak hash
110 int
111 hash(char *s)
112 {
113 	disaster();
114 	return (0);
115 }
116 
117 #pragma weak rename_map
118 bool
119 rename_map(char *from, char *to, bool_t secure_map)
120 {
121 	disaster();
122 	return (FALSE);
123 }
124 
125 #pragma weak delete_map
126 bool
127 delete_map(char *name)
128 {
129 	disaster();
130 	return (FALSE);
131 }
132 
133 #pragma weak single
134 #pragma weak nogecos
135 #pragma weak noshell
136 #pragma weak nopw
137 #pragma weak mflag
138 int single, nogecos, noshell, nopw, mflag;
139 
140 #pragma weak validloginshell
141 bool_t
142 validloginshell(char *sh, char *arg, int priv)
143 {
144 	disaster();
145 	return (0);
146 }
147 
148 #pragma weak validstr
149 int
150 validstr(char *str, size_t size)
151 {
152 	disaster();
153 	return (0);
154 }
155