xref: /titanic_52/usr/src/lib/libnisdb/yptol/stubs.c (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
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 2004 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 }
75 
76 #pragma weak unlock_core
77 int
78 unlock_core(int hashval)
79 {
80 	disaster();
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 }
105 
106 #pragma weak hash
107 int
108 hash(char *s)
109 {
110 	disaster();
111 }
112 
113 #pragma weak rename_map
114 bool
115 rename_map(char *from, char *to, bool_t secure_map)
116 {
117 	disaster();
118 }
119 
120 #pragma weak delete_map
121 bool
122 delete_map(char *name)
123 {
124 	disaster();
125 }
126 
127 #pragma weak single
128 #pragma weak nogecos
129 #pragma weak noshell
130 #pragma weak nopw
131 #pragma weak mflag
132 int single, nogecos, noshell, nopw, mflag;
133 
134 #pragma weak validloginshell
135 bool_t
136 validloginshell(char *sh, char *arg, int priv)
137 {
138 	disaster();
139 }
140 
141 #pragma weak validstr
142 int
143 validstr(char *str, size_t size)
144 {
145 	disaster();
146 	return (0);
147 }
148