~ubuntu-branches/debian/sid/kamailio/sid

« back to all changes in this revision

Viewing changes to modules/tls/tls_util.c

  • Committer: Package Import Robot
  • Author(s): Victor Seva
  • Date: 2014-01-06 11:47:13 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140106114713-t8xidp4arzrnyeya
Tags: 4.1.1-1
* New upstream release
* debian/patches:
  - add upstream fixes
* Added tls outbound websocket autheph dnssec modules
  - openssl exception added to their license
* removing sparc and ia64 from supported archs
  for mono module (Closes: #728915)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * $Id$
3
 
 *
4
 
 * TLS module - common functions
5
 
 *
6
 
 * Copyright (C) 2001-2003 FhG FOKUS
7
 
 * Copyright (C) 2004,2005 Free Software Foundation, Inc.
 
1
/* 
 
2
 * TLS module
 
3
 *
8
4
 * Copyright (C) 2005 iptelorg GmbH
9
 
 *
10
 
 * This file is part of SIP-router, a free SIP server.
11
 
 *
12
 
 * SIP-router is free software; you can redistribute it and/or modify
13
 
 * it under the terms of the GNU General Public License as published by
14
 
 * the Free Software Foundation; either version 2 of the License, or
15
 
 * (at your option) any later version
16
 
 *
17
 
 * SIP-router is distributed in the hope that it will be useful,
18
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 
 * GNU General Public License for more details.
21
 
 *
22
 
 * You should have received a copy of the GNU General Public License
23
 
 * along with this program; if not, write to the Free Software
24
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
5
 * Copyright (C) 2013 Motorola Solutions, Inc.
 
6
 *
 
7
 * Permission to use, copy, modify, and distribute this software for any
 
8
 * purpose with or without fee is hereby granted, provided that the above
 
9
 * copyright notice and this permission notice appear in all copies.
 
10
 *
 
11
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 
12
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 
13
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 
14
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 
15
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 
16
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 
17
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25
18
 */
26
19
 
 
20
 
27
21
#define _GNU_SOURCE 1 /* Needed for strndup */
28
22
 
29
23
#include <string.h>
30
24
#include <libgen.h>
31
25
#include "../../mem/shm_mem.h"
32
26
#include "../../globals.h"
 
27
#include "../../dprint.h"
33
28
#include "tls_mod.h"
34
29
#include "tls_util.h"
35
30
/*!
73
68
 */
74
69
void collect_garbage(void)
75
70
{
76
 
        tls_domains_cfg_t* prev, *cur;
 
71
        tls_domains_cfg_t *prev, *cur, *next;
77
72
 
78
73
             /* Make sure we do not run two garbage collectors
79
74
              * at the same time
87
82
        cur = (*tls_domains_cfg)->next;
88
83
 
89
84
        while(cur) {
 
85
                next = cur->next;
90
86
                if (cur->ref_count == 0) {
91
 
                             /* Not referenced by any existing connection */
 
87
                        /* Not referenced by any existing connection */
92
88
                        prev->next = cur->next;
93
89
                        tls_free_cfg(cur);
 
90
                } else {
 
91
                        /* Only update prev if we didn't remove cur */
 
92
                        prev = cur;
94
93
                }
95
 
 
96
 
                prev = cur;
97
 
                cur = cur->next;
 
94
                cur = next;
98
95
        }
99
96
 
100
97
        lock_release(tls_domains_cfg_lock);