source: branches/samba-3.0/source/libsmb/libsmb_cache.c@ 372

Last change on this file since 372 was 1, checked in by Paul Smedley, 19 years ago

Initial code import

File size: 7.8 KB
Line 
1
2/*
3 Unix SMB/CIFS implementation.
4 SMB client library implementation (server cache)
5 Copyright (C) Andrew Tridgell 1998
6 Copyright (C) Richard Sharpe 2000
7 Copyright (C) John Terpstra 2000
8 Copyright (C) Tom Jansen (Ninja ISD) 2002
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23*/
24
25#include "includes.h"
26
27#include "include/libsmbclient.h"
28#include "../include/libsmb_internal.h"
29
30int smbc_default_cache_functions(SMBCCTX * context);
31
32/*
33 * Structure we use if internal caching mechanism is used
34 * nothing fancy here.
35 */
36struct smbc_server_cache {
37 char *server_name;
38 char *share_name;
39 char *workgroup;
40 char *username;
41 SMBCSRV *server;
42
43 struct smbc_server_cache *next, *prev;
44};
45
46
47
48/*
49 * Add a new connection to the server cache.
50 * This function is only used if the external cache is not enabled
51 */
52static int smbc_add_cached_server(SMBCCTX * context, SMBCSRV * newsrv,
53 const char * server, const char * share,
54 const char * workgroup, const char * username)
55{
56 struct smbc_server_cache * srvcache = NULL;
57