Coverage Report

Created: 2026-09-13 07:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/tdengine/source/libs/transport/src/transSasl.c
Line
Count
Source
1
/** Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
2
 *
3
 * This program is free software: you can use, redistribute, and/or modify
4
 * it under the terms of the GNU Affero General Public License, version 3
5
 * or later ("AGPL"), as published by the Free Software Foundation.
6
 *
7
 * This program is distributed in the hope that it will be useful, but WITHOUT
8
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9
 * FITNESS FOR A PARTICULAR PURPOSE.
10
 *
11
 * You should have received a copy of the GNU Affero General Public License
12
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
13
 */
14
15
// clang-format off
16
#include "transSasl.h"
17
// clang-format on
18
19
20
extern void saslLibInitImpl(); 
21
extern void saslLibCleanupImpl();
22
extern int32_t saslConnCreateImpl(SSaslConn** ppConn, int8_t server);
23
    
24
extern int32_t saslConnInitImpl(SSaslConn* pConn);
25
26
extern void    saslConnCleanupImpl(SSaslConn* pConn);
27
extern void saslConnSetStateImpl(SSaslConn* pConn, int32_t state);
28
extern int32_t saslConnEncodeImpl(SSaslConn* pConn, const char* input, int32_t len, const char** output, unsigned* outputLen);
29
extern int32_t saslConnDecodeImpl(SSaslConn* pConn, const char* input, int32_t len, const char** output, unsigned* outputLen);
30
extern int32_t saslConnHandleAuthImpl(SSaslConn* pConn, const char* input, int32_t len);
31
32
extern int8_t  saslConnShoudDoAuthImpl(SSaslConn* pConn);
33
// int32_t saslConnStartAuth(SSaslConn* pConn);
34
35
// sasl buffer func
36
extern int32_t saslBufferInitImpl(SSaslBuffer* buf, int32_t cap);
37
extern int32_t saslBufferAppendImpl(SSaslBuffer* buf, uint8_t* data, int32_t len);
38
extern void    saslBufferCleanupImpl(SSaslBuffer* buf);
39
extern void    saslBufferClearImpl(SSaslBuffer* buf);
40
41
0
void saslLibInit() {
42
0
   saslLibInitImpl();   
43
0
}
44
45
0
void saslLibCleanup() {
46
0
    saslLibCleanupImpl();    
47
0
}
48
49
0
int32_t saslConnCreate(SSaslConn** ppConn, int8_t server) {
50
0
  return saslConnCreateImpl(ppConn, server);
51
0
}
52
53
0
void saslConnSetState(SSaslConn* pConn, int32_t state) {
54
0
  saslConnSetStateImpl(pConn, state);
55
0
}
56
57
58
0
int32_t saslConnInit(SSaslConn* pConn) {
59
0
  return saslConnInitImpl(pConn);
60
0
}
61
62
0
void saslConnCleanup(SSaslConn* pConn) {
63
0
  saslConnCleanupImpl(pConn);
64
0
}
65
66
0
int32_t saslConnEncode(SSaslConn* pConn, const char* input, int32_t len, const char** output, unsigned* outputLen) {
67
0
  return saslConnEncodeImpl(pConn, input, len, output, outputLen);
68
0
}
69
70
0
int32_t saslConnDecode(SSaslConn* pConn, const char* input, int32_t len, const char** output, unsigned* outputLen) {
71
0
  return saslConnDecodeImpl(pConn, input, len, output, outputLen);
72
0
}
73
74
0
int8_t saslAuthIsInited(SSaslConn* pConn) {
75
0
  return saslConnShoudDoAuthImpl(pConn);
76
0
}
77
78
79
0
int32_t saslConnHandleAuth(SSaslConn* pConn, const char* input, int32_t len) {
80
0
  return saslConnHandleAuthImpl(pConn, input, len);
81
0
}
82
83
84
0
int32_t saslBufferInit(SSaslBuffer* buf, int32_t cap) {
85
0
  return saslBufferInitImpl(buf, cap);  
86
0
}
87
88
0
int32_t saslBufferAppend(SSaslBuffer* buf, uint8_t* data, int32_t len) {
89
0
  return saslBufferAppendImpl(buf, data, len);
90
0
}
91
92
0
void saslBufferCleanup(SSaslBuffer* buf) {
93
0
  return saslBufferCleanupImpl(buf);  
94
0
}
95
96
0
void saslBufferClear(SSaslBuffer* buf) {
97
0
  saslBufferClearImpl(buf);
98
0
}
99
100
#if !defined(TD_ENTERPRISE)
101
102
0
void saslLibInitImpl() {
103
0
  return;
104
0
}
105
0
void saslLibCleanupImpl() {
106
0
  return;
107
0
}
108
0
int32_t saslConnCreateImpl(SSaslConn * *ppConn, int8_t server) {
109
0
  return TSDB_CODE_INVALID_CFG; 
110
0
}
111
112
0
int32_t saslConnInitImpl(SSaslConn * pConn) {
113
0
  return TSDB_CODE_INVALID_CFG; 
114
0
}
115
116
0
void saslConnCleanupImpl(SSaslConn * pConn) {
117
0
  return;
118
0
}
119
120
0
void saslConnSetStateImpl(SSaslConn* pConn, int32_t state) { return; }
121
122
int32_t saslConnEncodeImpl(SSaslConn * pConn, const char* input, int32_t len, const char** output,
123
0
                           unsigned* outputLen) {
124
0
  return TSDB_CODE_INVALID_CFG; 
125
126
0
}
127
int32_t saslConnDecodeImpl(SSaslConn * pConn, const char* input, int32_t len, const char** output,
128
0
                           unsigned* outputLen) {
129
0
  return TSDB_CODE_INVALID_CFG; 
130
131
0
}
132
0
int32_t saslConnHandleAuthImpl(SSaslConn * pConn, const char* input, int32_t len) {
133
0
  return TSDB_CODE_INVALID_CFG; 
134
0
}
135
136
0
int8_t saslConnShoudDoAuthImpl(SSaslConn * pConn) {
137
0
  if (pConn == NULL) return 1;
138
0
  return 0;
139
0
}
140
141
// sasl buffer func
142
0
int32_t saslBufferInitImpl(SSaslBuffer * buf, int32_t cap) {
143
0
  return TSDB_CODE_INVALID_PARA;
144
0
}
145
0
int32_t saslBufferAppendImpl(SSaslBuffer* buf, uint8_t* data, int32_t len) {
146
0
  return TSDB_CODE_INVALID_PARA;
147
0
}
148
0
void  saslBufferCleanupImpl(SSaslBuffer* buf) {
149
0
  return;
150
0
}
151
0
void saslBufferClearImpl(SSaslBuffer* buf) {
152
0
  return;
153
0
}
154
155
#endif