1*7934SMark.Phalan@Sun.COM /*
2*7934SMark.Phalan@Sun.COM  * Copyright (C) 2004 by the Massachusetts Institute of Technology,
3*7934SMark.Phalan@Sun.COM  * Cambridge, MA, USA.  All Rights Reserved.
4*7934SMark.Phalan@Sun.COM  *
5*7934SMark.Phalan@Sun.COM  * This software is being provided to you, the LICENSEE, by the
6*7934SMark.Phalan@Sun.COM  * Massachusetts Institute of Technology (M.I.T.) under the following
7*7934SMark.Phalan@Sun.COM  * license.  By obtaining, using and/or copying this software, you agree
8*7934SMark.Phalan@Sun.COM  * that you have read, understood, and will comply with these terms and
9*7934SMark.Phalan@Sun.COM  * conditions:
10*7934SMark.Phalan@Sun.COM  *
11*7934SMark.Phalan@Sun.COM  * Export of this software from the United States of America may
12*7934SMark.Phalan@Sun.COM  * require a specific license from the United States Government.
13*7934SMark.Phalan@Sun.COM  * It is the responsibility of any person or organization contemplating
14*7934SMark.Phalan@Sun.COM  * export to obtain such a license before exporting.
15*7934SMark.Phalan@Sun.COM  *
16*7934SMark.Phalan@Sun.COM  * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute
17*7934SMark.Phalan@Sun.COM  * this software and its documentation for any purpose and without fee or
18*7934SMark.Phalan@Sun.COM  * royalty is hereby granted, provided that you agree to comply with the
19*7934SMark.Phalan@Sun.COM  * following copyright notice and statements, including the disclaimer, and
20*7934SMark.Phalan@Sun.COM  * that the same appear on ALL copies of the software and documentation,
21*7934SMark.Phalan@Sun.COM  * including modifications that you make for internal use or for
22*7934SMark.Phalan@Sun.COM  * distribution:
23*7934SMark.Phalan@Sun.COM  *
24*7934SMark.Phalan@Sun.COM  * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
25*7934SMark.Phalan@Sun.COM  * OR WARRANTIES, EXPRESS OR IMPLIED.  By way of example, but not
26*7934SMark.Phalan@Sun.COM  * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
27*7934SMark.Phalan@Sun.COM  * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
28*7934SMark.Phalan@Sun.COM  * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
29*7934SMark.Phalan@Sun.COM  * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
30*7934SMark.Phalan@Sun.COM  *
31*7934SMark.Phalan@Sun.COM  * The name of the Massachusetts Institute of Technology or M.I.T. may NOT
32*7934SMark.Phalan@Sun.COM  * be used in advertising or publicity pertaining to distribution of the
33*7934SMark.Phalan@Sun.COM  * software.  Title to copyright in this software and any associated
34*7934SMark.Phalan@Sun.COM  * documentation shall at all times remain with M.I.T., and USER agrees to
35*7934SMark.Phalan@Sun.COM  * preserve same.
36*7934SMark.Phalan@Sun.COM  *
37*7934SMark.Phalan@Sun.COM  * Furthermore if you modify this software you must label
38*7934SMark.Phalan@Sun.COM  * your software as modified software and not distribute it in such a
39*7934SMark.Phalan@Sun.COM  * fashion that it might be confused with the original M.I.T. software.
40*7934SMark.Phalan@Sun.COM  */
41*7934SMark.Phalan@Sun.COM 
42*7934SMark.Phalan@Sun.COM /* Stuff that needs initialization for fake-addrinfo.c.
43*7934SMark.Phalan@Sun.COM 
44*7934SMark.Phalan@Sun.COM    Separated out, so that static linking against this library doesn't
45*7934SMark.Phalan@Sun.COM    require pulling in socket/nsl/whatever libraries for code not using
46*7934SMark.Phalan@Sun.COM    getaddrinfo.  */
47*7934SMark.Phalan@Sun.COM 
48*7934SMark.Phalan@Sun.COM #include "port-sockets.h"
49*7934SMark.Phalan@Sun.COM #include "socket-utils.h"
50*7934SMark.Phalan@Sun.COM #include "k5-platform.h"
51*7934SMark.Phalan@Sun.COM #include "k5-thread.h"
52*7934SMark.Phalan@Sun.COM 
53*7934SMark.Phalan@Sun.COM #include <stdio.h>		/* for sprintf */
54*7934SMark.Phalan@Sun.COM #include <errno.h>
55*7934SMark.Phalan@Sun.COM 
56*7934SMark.Phalan@Sun.COM #define IMPLEMENT_FAKE_GETADDRINFO
57*7934SMark.Phalan@Sun.COM #include "fake-addrinfo.h"
58*7934SMark.Phalan@Sun.COM #include "cache-addrinfo.h"
59*7934SMark.Phalan@Sun.COM 
60*7934SMark.Phalan@Sun.COM struct fac krb5int_fac = { K5_MUTEX_PARTIAL_INITIALIZER, 0 };
61*7934SMark.Phalan@Sun.COM 
krb5int_init_fac(void)62*7934SMark.Phalan@Sun.COM int krb5int_init_fac (void)
63*7934SMark.Phalan@Sun.COM {
64*7934SMark.Phalan@Sun.COM     return k5_mutex_finish_init(&krb5int_fac.lock);
65*7934SMark.Phalan@Sun.COM }
66*7934SMark.Phalan@Sun.COM 
krb5int_fini_fac(void)67*7934SMark.Phalan@Sun.COM void krb5int_fini_fac (void)
68*7934SMark.Phalan@Sun.COM {
69*7934SMark.Phalan@Sun.COM     k5_mutex_destroy(&krb5int_fac.lock);
70*7934SMark.Phalan@Sun.COM }
71