summaryrefslogtreecommitdiffstats
path: root/pki/base/tps/src/main/AuthenticationEntry.cpp
blob: eb7f75419b3bbc7b3ff8f0a3937387312626dec8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// --- BEGIN COPYRIGHT BLOCK ---
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation;
// version 2.1 of the License.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor,
// Boston, MA  02110-1301  USA 
// 
// Copyright (C) 2007 Red Hat, Inc.
// All rights reserved.
// --- END COPYRIGHT BLOCK ---

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "plstr.h"
#include "main/AuthenticationEntry.h"

/**
 * Constructs a base authentication
 */
AuthenticationEntry::AuthenticationEntry ()
{
    m_lib = NULL;
    m_Id = NULL;
    m_type = NULL; 
    m_authentication = NULL;
}

/**
 * Destructs processor.
 */
AuthenticationEntry::~AuthenticationEntry ()
{
    if (m_lib != NULL) {
        PR_UnloadLibrary(m_lib);
        m_lib = NULL; 
    }

    if( m_Id != NULL ) {
        PL_strfree( m_Id ); 
        m_Id = NULL; 
    }

    if( m_type != NULL ) {
        PL_strfree( m_type ); 
        m_type = NULL; 
    }

    m_authentication = NULL;
}

void AuthenticationEntry::SetLibrary(PRLibrary* lib) {
    m_lib = lib;
}

PRLibrary *AuthenticationEntry::GetLibrary() {
    return m_lib;
}

void AuthenticationEntry::SetId(const char *id) {
    m_Id = PL_strdup(id);
}

char *AuthenticationEntry::GetId() {
    return m_Id;
}

void AuthenticationEntry::SetAuthentication(Authentication *auth) {
    m_authentication = auth;
}

Authentication *AuthenticationEntry::GetAuthentication() {
    return m_authentication;
}

void AuthenticationEntry::SetType(const char *type) {
    m_type = PL_strdup(type);
}

char *AuthenticationEntry::GetType() {
    return m_type;
}