1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /* gkr-pam-stubs.c - Stubs to allow linking memory code
3 
4    Copyright (C) 2007 Stef Walter
5 
6    The Gnome Keyring Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Library General Public License as
8    published by the Free Software Foundation; either version 2 of the
9    License, or (at your option) any later version.
10 
11    The Gnome Keyring Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Library General Public License for more details.
15 
16    You should have received a copy of the GNU Library General Public
17    License along with the Gnome Library; see the file COPYING.LIB.  If not,
18    <http://www.gnu.org/licenses/>.
19 
20    Author: Stef Walter <stef@memberwebs.com>
21 */
22 
23 #include "egg/egg-secure-memory.h"
24 
25 #include <stdlib.h>
26 
27 /*
28  * These are called from gkr-secure-memory.c to provide appropriate
29  * locking for memory between threads
30  */
31 
32 static void
egg_memory_lock(void)33 egg_memory_lock (void)
34 {
35 	/* No threads in PAM, no locking */
36 }
37 
38 static void
egg_memory_unlock(void)39 egg_memory_unlock (void)
40 {
41 	/* No threads in PAM, no locking */
42 }
43 
44 static void *
egg_memory_fallback(void * p,size_t sz)45 egg_memory_fallback (void *p, size_t sz)
46 {
47 	/* Handles allocation, reallocation and freeing */
48 	return realloc (p, sz);
49 }
50 
51 EGG_SECURE_DEFINE_GLOBALS (egg_memory_lock, egg_memory_unlock, egg_memory_fallback);
52