3d30ad227985e93fc7043e3f9efdb59ab17e340c
1 /* Initialization and finalization of the dynamic XAUTH module
2 * Copyright (C) 2006 Andreas Steffen
3 * Hochschule fuer Technik Rapperswil, Switzerland
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * RCSID $Id: xauth.c,v 1.1 2005/01/06 22:10:15 as Exp $
22 #include "constants.h"
31 #ifdef XAUTH_DEFAULT_LIB
32 xauth_module
.handle
= dlopen(XAUTH_DEFAULT_LIB
, RTLD_NOW
);
34 if (xauth_module
.handle
!= NULL
)
37 DBG_log("xauth module '%s' loading'", XAUTH_DEFAULT_LIB
)
39 xauth_module
.get_secret
= (bool (*) (const xauth_t
*))
40 dlsym(xauth_module
.handle
, "get_secret");
42 if (xauth_module
.get_secret
!= NULL
)
44 DBG_log("xauth module: found get_secret() function");
47 xauth_module
.verify_secret
= (bool (*) (const xauth_t
*))
48 dlsym(xauth_module
.handle
, "verify_secret");
50 if (xauth_module
.verify_secret
!= NULL
)
52 DBG_log("xauth module: found verify_secret() function");
57 /* any null function pointers will be filled in by default functions */
64 #ifdef XAUTH_DEFAULT_LIB
65 if (xauth_module
.handle
!= NULL
)
67 if (dlclose(xauth_module
.handle
))
69 plog("failed to unload xauth module");
74 DBG_log("xauth module unloaded")