@@ -29,8 +29,6 @@ static inline ATTR_WARN_UNUSED mpack_error_t _omsg_finish(
29
29
static inline void _omsg_destroy (dd_omsg * nonnull omsg );
30
30
static inline dd_result _omsg_send (
31
31
dd_conn * nonnull conn , dd_omsg * nonnull omsg );
32
- static inline dd_result _omsg_send_cred (
33
- dd_conn * nonnull conn , dd_omsg * nonnull omsg );
34
32
static void _dump_in_msg (
35
33
dd_log_level_t lvl , const char * nonnull data , size_t data_len );
36
34
static void _dump_out_msg (dd_log_level_t lvl , zend_llist * iovecs );
@@ -42,16 +40,14 @@ typedef struct _dd_imsg {
42
40
mpack_node_t root ;
43
41
} dd_imsg ;
44
42
45
- // iif these two return success, _imsg_destroy must be called
46
- static inline dd_result _imsg_recv (
47
- dd_imsg * nonnull imsg , dd_conn * nonnull conn );
48
- static inline ATTR_WARN_UNUSED dd_result _imsg_recv_cred (
43
+ // iif this returns success, _imsg_destroy must be called
44
+ static dd_result ATTR_WARN_UNUSED _imsg_recv (
49
45
dd_imsg * nonnull imsg , dd_conn * nonnull conn );
50
46
51
47
static inline ATTR_WARN_UNUSED mpack_error_t _imsg_destroy (
52
48
dd_imsg * nonnull imsg );
53
49
54
- static dd_result _dd_command_exec (dd_conn * nonnull conn , bool check_cred ,
50
+ static dd_result _dd_command_exec (dd_conn * nonnull conn ,
55
51
const dd_command_spec * nonnull spec , void * unspecnull ctx )
56
52
{
57
53
#define NAME_L (int)spec->name_len, spec->name
@@ -78,11 +74,7 @@ static dd_result _dd_command_exec(dd_conn *nonnull conn, bool check_cred,
78
74
return dd_error ;
79
75
}
80
76
81
- if (check_cred ) {
82
- res = _omsg_send_cred (conn , & omsg );
83
- } else {
84
- res = _omsg_send (conn , & omsg );
85
- }
77
+ res = _omsg_send (conn , & omsg );
86
78
_dump_out_msg (dd_log_trace , & omsg .iovecs );
87
79
_omsg_destroy (& omsg );
88
80
if (res ) {
@@ -96,11 +88,7 @@ static dd_result _dd_command_exec(dd_conn *nonnull conn, bool check_cred,
96
88
dd_result res ;
97
89
{
98
90
dd_imsg imsg = {0 };
99
- if (check_cred ) {
100
- res = _imsg_recv_cred (& imsg , conn );
101
- } else {
102
- res = _imsg_recv (& imsg , conn );
103
- }
91
+ res = _imsg_recv (& imsg , conn );
104
92
if (res ) {
105
93
if (res != dd_helper_error ) {
106
94
mlog (dd_log_warning ,
@@ -194,20 +182,25 @@ static dd_result _dd_command_exec(dd_conn *nonnull conn, bool check_cred,
194
182
dd_result ATTR_WARN_UNUSED dd_command_exec (dd_conn * nonnull conn ,
195
183
const dd_command_spec * nonnull spec , void * unspecnull ctx )
196
184
{
197
- return _dd_command_exec (conn , false, spec , ctx );
185
+ return _dd_command_exec (conn , spec , ctx );
198
186
}
199
187
200
188
dd_result ATTR_WARN_UNUSED dd_command_exec_req_info (dd_conn * nonnull conn ,
201
189
const dd_command_spec * nonnull spec , struct req_info * nonnull ctx )
202
190
{
203
191
ctx -> command_name = spec -> name ;
204
- return _dd_command_exec (conn , false, spec , ctx );
192
+ return _dd_command_exec (conn , spec , ctx );
205
193
}
206
194
207
195
dd_result ATTR_WARN_UNUSED dd_command_exec_cred (dd_conn * nonnull conn ,
208
196
const dd_command_spec * nonnull spec , void * unspecnull ctx )
209
197
{
210
- return _dd_command_exec (conn , true, spec , ctx );
198
+ dd_result res = dd_conn_check_credentials (conn );
199
+ if (res ) {
200
+ return res ;
201
+ }
202
+
203
+ return _dd_command_exec (conn , spec , ctx );
211
204
}
212
205
213
206
// outgoing
@@ -247,24 +240,13 @@ static inline dd_result _omsg_send(dd_conn *nonnull conn, dd_omsg *nonnull omsg)
247
240
return dd_conn_sendv (conn , & omsg -> iovecs );
248
241
}
249
242
250
- static inline dd_result _omsg_send_cred (
251
- dd_conn * nonnull conn , dd_omsg * nonnull omsg )
252
- {
253
- return dd_conn_sendv_cred (conn , & omsg -> iovecs );
254
- }
255
-
256
243
// incoming
257
- static inline dd_result _dd_imsg_recv (
258
- dd_imsg * nonnull imsg , dd_conn * nonnull conn , bool check_cred )
244
+ static ATTR_WARN_UNUSED dd_result _imsg_recv (
245
+ dd_imsg * nonnull imsg , dd_conn * nonnull conn )
259
246
{
260
247
mlog (dd_log_debug , "Will receive response from helper" );
261
248
262
- dd_result res ;
263
- if (check_cred ) {
264
- res = dd_conn_recv_cred (conn , & imsg -> _data , & imsg -> _size );
265
- } else {
266
- res = dd_conn_recv (conn , & imsg -> _data , & imsg -> _size );
267
- }
249
+ dd_result res = dd_conn_recv (conn , & imsg -> _data , & imsg -> _size );
268
250
if (res ) {
269
251
return res ;
270
252
}
@@ -290,17 +272,6 @@ static inline dd_result _dd_imsg_recv(
290
272
return dd_success ;
291
273
}
292
274
293
- ATTR_WARN_UNUSED dd_result _imsg_recv (
294
- dd_imsg * nonnull imsg , dd_conn * nonnull conn )
295
- {
296
- return _dd_imsg_recv (imsg , conn , false);
297
- }
298
- ATTR_WARN_UNUSED dd_result _imsg_recv_cred (
299
- dd_imsg * nonnull imsg , dd_conn * nonnull conn )
300
- {
301
- return _dd_imsg_recv (imsg , conn , true);
302
- }
303
-
304
275
static inline ATTR_WARN_UNUSED mpack_error_t _imsg_destroy (
305
276
dd_imsg * nonnull imsg )
306
277
{
0 commit comments