1 |
/* wptKeyCache.cpp- Caching for the pub- and the secring |
/* wptKeyCache.cpp- Caching for the pub- and the secring |
2 |
* Copyright (C) 2001-2006 Timo Schulz |
* Copyright (C) 2001-2006, 2009 Timo Schulz |
3 |
* |
* |
4 |
* This file is part of WinPT. |
* This file is part of WinPT. |
5 |
* |
* |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
* GNU General Public License for more details. |
|
* |
|
|
* You should have received a copy of the GNU General Public License |
|
|
* along with this program; if not, write to the Free Software |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
15 |
*/ |
*/ |
16 |
|
|
17 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
51 |
typedef struct attr_list_s *attr_list_t; |
typedef struct attr_list_s *attr_list_t; |
52 |
|
|
53 |
|
|
|
/* XXX: convert it to an inline function and place it in a header file. */ |
|
54 |
static unsigned char* |
static unsigned char* |
55 |
safe_uchar_alloc (size_t n) |
safe_uchar_alloc (size_t n) |
56 |
{ |
{ |
62 |
|
|
63 |
|
|
64 |
/* Free attribute list @ctx. */ |
/* Free attribute list @ctx. */ |
65 |
void |
static void |
66 |
free_attr_list (attr_list_t ctx) |
free_attr_list (attr_list_t ctx) |
67 |
{ |
{ |
68 |
attr_list_t n; |
attr_list_t n; |
158 |
fwrite (status, 1, strlen (status), tmp); |
fwrite (status, 1, strlen (status), tmp); |
159 |
fflush (tmp); |
fflush (tmp); |
160 |
rewind (tmp); |
rewind (tmp); |
|
|
|
161 |
ndata = parse_attr_list (tmp, data, ndata, list); |
ndata = parse_attr_list (tmp, data, ndata, list); |
|
fclose (tmp); |
|
|
DeleteFile (tmpnam); |
|
162 |
} |
} |
163 |
else |
else |
164 |
*list = NULL; |
*list = NULL; |
165 |
|
if (tmp != NULL) { |
166 |
|
fclose (tmp); |
167 |
|
DeleteFile (tmpnam); |
168 |
|
} |
169 |
|
|
170 |
safe_free (status); |
safe_free (status); |
171 |
safe_free (data); |
safe_free (data); |