]> git.sesse.net Git - betaftpd/blob - dcache.h
Fixed a security problem where the custom snprintf() would always be used. Thanks...
[betaftpd] / dcache.h
1 /*  dcache.h: BetaFTPD directory cache prototypes
2     Copyright (C) 2000 Steinar H. Gunderson
3
4     This program is is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License, version 2 of the
6     License as published by the Free Software Foundation.
7
8     This program is distributed in the hope that it will be useful,
9     but WITHOUT ANY WARRANTY; without even the implied warranty of
10     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11     GNU General Public License for more details.
12
13     You should have received a copy of the GNU General Public License
14     along with this program; if not, write to the Free Software
15     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 */
17
18 #ifndef _DCACHE_H
19 #define _DCACHE_H 1
20
21 #if HAVE_TIME_H
22 #include <time.h>
23 #endif
24
25 #if HAVE_SYS_TIME_H
26 #include <sys/time.h>
27 #endif
28
29 #include <ftpd.h>
30
31 /* doubly linked list of cached directory listings */
32 struct dcache {
33         struct dcache *prev_dcache;
34         struct dcache *next_dcache;
35
36         int use_count;
37         time_t last_used;
38         time_t generated;
39
40         char dir_name[256];
41         char pattern[256];
42         struct list_options lo;
43
44         char *dir_data;
45         int dir_size;
46 };
47
48 struct dcache *alloc_new_dcache();
49 void destroy_dcache(struct dcache * const d);
50
51 void time_out_dcache();
52 void populate_dcache(struct ftran * const f, const char * const cwd,
53                      const char * const pattern, const struct list_options * const lo);
54 struct dcache *find_dcache(const char * const cwd, const char * const pattern, 
55                            const struct list_options * const lo);
56
57 #endif