@@ -479,7 +479,7 @@ nc_pam_auth(struct nc_session *session, struct nc_server_ssh_opts *opts, ssh_mes
479479
480480cleanup :
481481 /* destroy the PAM context */
482- if (pam_end (pam_h , ret ) != PAM_SUCCESS ) {
482+ if (pam_h && ( pam_end (pam_h , ret ) != PAM_SUCCESS ) ) {
483483 ERR (NULL , "PAM error occurred (%s).\n" , pam_strerror (pam_h , ret ));
484484 }
485485 return ret ;
@@ -551,11 +551,7 @@ nc_server_ssh_create_ssh_pubkey(const char *base64, ssh_key *key)
551551 const char * pub_type = NULL ;
552552 uint32_t pub_type_len = 0 ;
553553
554- if (!key && !base64 ) {
555- ERRINT ;
556- ret = 1 ;
557- goto cleanup ;
558- }
554+ NC_CHECK_ARG_RET (NULL , base64 , key , 1 );
559555
560556 * key = NULL ;
561557
@@ -1092,12 +1088,12 @@ static int
10921088nc_ssh_bind_add_hostkeys (ssh_bind sbind , struct nc_server_ssh_opts * opts , uint16_t hostkey_count )
10931089{
10941090 uint16_t i ;
1095- char * privkey_path , * privkey_data ;
1091+ char * privkey_path ;
10961092 int ret ;
10971093 struct nc_asymmetric_key * key = NULL ;
10981094
10991095 for (i = 0 ; i < hostkey_count ; ++ i ) {
1100- privkey_path = privkey_data = NULL ;
1096+ privkey_path = NULL ;
11011097
11021098 /* get the asymmetric key */
11031099 if (opts -> hostkeys [i ].store == NC_STORE_LOCAL ) {
@@ -1119,7 +1115,7 @@ nc_ssh_bind_add_hostkeys(ssh_bind sbind, struct nc_server_ssh_opts *opts, uint16
11191115 ret = ssh_bind_options_set (sbind , SSH_BIND_OPTIONS_HOSTKEY , privkey_path );
11201116
11211117 /* cleanup */
1122- if (privkey_data && unlink (privkey_path )) {
1118+ if (unlink (privkey_path )) {
11231119 WRN (NULL , "Removing a temporary host key file \"%s\" failed (%s)." , privkey_path , strerror (errno ));
11241120 }
11251121
0 commit comments