Skip to content

Commit 2d953d5

Browse files
remove debug printf's and make note for future logging location
1 parent c92904b commit 2d953d5

2 files changed

Lines changed: 4 additions & 21 deletions

File tree

src/wh_auth.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,13 @@ int wh_Auth_CheckRequestAuthorization(whAuthContext* context, uint16_t group,
160160
uint16_t action)
161161
{
162162
uint16_t user_id = context->user.user_id;
163+
int rc;
163164

164-
printf("In authorization check: User ID: %d, Group: %d, Action: %d\n",
165-
user_id, group, action);
165+
/* @TODO add logging call here and with resulting return value */
166166

167-
return context->cb->CheckRequestAuthorization(context->context, user_id,
167+
rc = context->cb->CheckRequestAuthorization(context->context, user_id,
168168
group, action);
169+
return rc;
169170
}
170171

171172

@@ -175,9 +176,6 @@ int wh_Auth_CheckKeyAuthorization(whAuthContext* context, uint32_t key_id,
175176
{
176177
uint16_t user_id = context->user.user_id;
177178

178-
printf("In key authorization check: User ID: %d, Key ID: %d, Action: %d\n",
179-
user_id, key_id, action);
180-
181179
return context->cb->CheckKeyAuthorization(context->context, user_id, key_id,
182180
action);
183181
}

src/wh_auth_base.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ int wh_AuthBase_Init(void* context, const void *config)
6868
/* add a demo user with admin permissions */
6969
rc = wh_AuthBase_UserAdd(context, "admin", &out_user_id, permissions,
7070
WH_AUTH_METHOD_PIN, "1234", 4);
71-
printf("Admin user added with ID: %d\n", out_user_id);
7271
return rc;
7372
}
7473

@@ -215,22 +214,17 @@ int wh_AuthBase_CheckRequestAuthorization(void* context,
215214
{
216215
int rc;
217216

218-
printf("In authorization check: User ID: %d, Group: %d, Action: %d\n",
219-
user_id, group, action);
220-
221217
if (user_id == WH_USER_ID_INVALID) {
222218
/* allow user login request attempt */
223219
if (group == WH_MESSAGE_GROUP_AUTH) {
224220
if (action == WH_MESSAGE_AUTH_ACTION_LOGIN) {
225221
rc = WH_ERROR_OK;
226222
}
227223
else {
228-
printf("User does not have permissions for the action");
229224
rc = WH_ERROR_ACCESS;
230225
}
231226
}
232227
else {
233-
printf("No user associated with session");
234228
rc = WH_ERROR_OK; /*rc = WH_ERROR_ACCESS;*/
235229
}
236230
}
@@ -254,12 +248,10 @@ int wh_AuthBase_CheckRequestAuthorization(void* context,
254248
rc = WH_ERROR_OK;
255249
}
256250
else {
257-
printf("User does not have permissions for the action");
258251
rc = WH_ERROR_ACCESS;
259252
}
260253
}
261254
else {
262-
printf("User does not have permissions for the group");
263255
rc = WH_ERROR_ACCESS;
264256
}
265257
}
@@ -278,9 +270,6 @@ int wh_AuthBase_CheckKeyAuthorization(void* context, uint16_t user_id,
278270
int i;
279271
whAuthBase_User* user;
280272

281-
printf("In key authorization check: User ID: %d, Key ID: %d, Action: %d\n",
282-
user_id, key_id, action);
283-
284273
if (user_id == WH_USER_ID_INVALID) {
285274
return WH_ERROR_ACCESS;
286275
}
@@ -303,10 +292,6 @@ int wh_AuthBase_CheckKeyAuthorization(void* context, uint16_t user_id,
303292
}
304293
}
305294

306-
if (rc != WH_ERROR_OK) {
307-
printf("User does not have access to the key");
308-
}
309-
310295
(void)context;
311296
(void)action; /* Action could be used for future fine-grained key access control */
312297
return rc;

0 commit comments

Comments
 (0)