~ubuntu-branches/ubuntu/trusty/aria2/trusty

« back to all changes in this revision

Viewing changes to src/AppleTLSSession.cc

  • Committer: Package Import Robot
  • Author(s): Kartik Mistry
  • Date: 2013-12-16 18:41:03 UTC
  • mfrom: (2.5.21 sid)
  • Revision ID: package-import@ubuntu.com-20131216184103-xzah3019zwut429g
Tags: 1.18.1-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
225
225
 
226
226
    SUITE(SSL_NO_SUCH_CIPHERSUITE)
227
227
  };
228
 
  static const size_t nSuites = sizeof(kSuites) / sizeof(*kSuites);
229
228
#undef SUITE
230
229
 
231
230
  static inline const char* suiteToString(const SSLCipherSuite suite)
232
231
  {
233
 
    for (size_t i = 0; i < nSuites; ++i) {
234
 
      if (kSuites[i].suite == suite) {
235
 
        return kSuites[i].name;
 
232
    for (auto & s : kSuites) {
 
233
      if (s.suite == suite) {
 
234
        return s.name;
236
235
      }
237
236
    }
238
237
    return "Unknown suite";
241
240
  static const char* kBlocked[] = {
242
241
    "NULL", "anon", "MD5", "EXPORT", "DES", "IDEA", "NO_SUCH", "EMPTY"
243
242
  };
244
 
  static const size_t nBlocked = sizeof(kBlocked) / sizeof(*kBlocked);
245
243
 
246
244
  static inline bool isBlockedSuite(SSLCipherSuite suite)
247
245
  {
248
246
    const char* name = suiteToString(suite);
249
 
    for (size_t i = 0; i < nBlocked; ++i) {
250
 
      if (strstr(name, kBlocked[i])) {
 
247
    for (auto& blocked : kBlocked) {
 
248
      if (strstr(name, blocked)) {
251
249
        return true;
252
250
      }
253
251
    }
335
333
  }
336
334
#endif
337
335
 
338
 
  if (ctx->getSide() != TLS_SERVER) {
339
 
    // Done with client-only initialization
340
 
    return;
341
 
  }
342
 
 
343
336
  SecIdentityRef creds = ctx->getCredentials();
344
337
  if (!creds) {
 
338
    if (ctx->getSide() != TLS_SERVER) {
 
339
      // Done with client-only initialization
 
340
      return;
 
341
    }
 
342
 
345
343
    A2_LOG_ERROR("AppleTLS: No credentials");
346
344
    state_ = st_error;
347
345
    return;