Mercurial > dropbear
comparison common-runopts.c @ 1733:d529a52b2f7c coverity coverity
merge coverity from main
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 26 Jun 2020 21:07:34 +0800 |
parents | f8d8af12ac14 |
children | 94dc11094e26 |
comparison
equal
deleted
inserted
replaced
1643:b59623a64678 | 1733:d529a52b2f7c |
---|---|
62 return ret; | 62 return ret; |
63 } | 63 } |
64 | 64 |
65 #if DROPBEAR_USER_ALGO_LIST | 65 #if DROPBEAR_USER_ALGO_LIST |
66 void | 66 void |
67 parse_ciphers_macs() | 67 parse_ciphers_macs() { |
68 { | 68 int printed_help = 0; |
69 if (opts.cipher_list) | 69 if (opts.cipher_list) { |
70 { | 70 if (strcmp(opts.cipher_list, "help") == 0) { |
71 if (strcmp(opts.cipher_list, "help") == 0) | |
72 { | |
73 char *ciphers = algolist_string(sshciphers); | 71 char *ciphers = algolist_string(sshciphers); |
74 dropbear_log(LOG_INFO, "Available ciphers:\n%s\n", ciphers); | 72 dropbear_log(LOG_INFO, "Available ciphers: %s", ciphers); |
75 m_free(ciphers); | 73 m_free(ciphers); |
76 dropbear_exit("."); | 74 printed_help = 1; |
77 } | 75 } else { |
78 | 76 if (check_user_algos(opts.cipher_list, sshciphers, "cipher") == 0) { |
79 if (strcmp(opts.cipher_list, "none") == 0) | 77 dropbear_exit("No valid ciphers specified for '-c'"); |
80 { | 78 } |
81 /* Encryption is required during authentication */ | |
82 opts.cipher_list = "none,aes128-ctr"; | |
83 } | |
84 | |
85 if (check_user_algos(opts.cipher_list, sshciphers, "cipher") == 0) | |
86 { | |
87 dropbear_exit("No valid ciphers specified for '-c'"); | |
88 } | 79 } |
89 } | 80 } |
90 | 81 |
91 if (opts.mac_list) | 82 if (opts.mac_list) { |
92 { | 83 if (strcmp(opts.mac_list, "help") == 0) { |
93 if (strcmp(opts.mac_list, "help") == 0) | |
94 { | |
95 char *macs = algolist_string(sshhashes); | 84 char *macs = algolist_string(sshhashes); |
96 dropbear_log(LOG_INFO, "Available MACs:\n%s\n", macs); | 85 dropbear_log(LOG_INFO, "Available MACs: %s", macs); |
97 m_free(macs); | 86 m_free(macs); |
98 dropbear_exit("."); | 87 printed_help = 1; |
88 } else { | |
89 if (check_user_algos(opts.mac_list, sshhashes, "MAC") == 0) { | |
90 dropbear_exit("No valid MACs specified for '-m'"); | |
91 } | |
99 } | 92 } |
100 | 93 } |
101 if (check_user_algos(opts.mac_list, sshhashes, "MAC") == 0) | 94 if (printed_help) { |
102 { | 95 dropbear_exit("."); |
103 dropbear_exit("No valid MACs specified for '-m'"); | |
104 } | |
105 } | 96 } |
106 } | 97 } |
107 #endif | 98 #endif |
108 | 99 |
109 void print_version() { | 100 void print_version() { |