Skip to content

Commit e4fbae9

Browse files
committed
server config REFACTOR avoid warnings
1 parent 956e73f commit e4fbae9

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

src/server_config_util_ssh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ _nc_server_config_add_ssh_user_password(const struct ly_ctx *ctx, const char *tr
502502

503503
NC_CHECK_ARG_RET(NULL, ctx, tree_path, password, config, 1);
504504

505-
cdata = calloc(1, sizeof(struct crypt_data));
505+
cdata = calloc(1, sizeof *cdata);
506506
NC_CHECK_ERRMEM_GOTO(!cdata, ret = 1, cleanup);
507507

508508
hashed_pw = crypt_r(password, salt, cdata);

src/session_server_ssh.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -646,11 +646,8 @@ nc_server_ssh_compare_password(const char *stored_pw, const char *received_pw)
646646
return strcmp(stored_pw + 3, received_pw);
647647
}
648648

649-
cdata = (struct crypt_data *) calloc(sizeof(struct crypt_data), 1);
650-
if (cdata == NULL) {
651-
ERR(NULL, "Allocation of crypt_data struct failed.");
652-
return 1;
653-
}
649+
cdata = calloc(1, sizeof *cdata);
650+
NC_CHECK_ERRMEM_RET(!cdata, 1);
654651

655652
received_pw_hash = crypt_r(received_pw, stored_pw, cdata);
656653
if (!received_pw_hash) {

0 commit comments

Comments
 (0)