Changeset 32579


Ignore:
Timestamp:
Jul 6, 2017, 6:09:23 PM (3 weeks ago)
Author:
brainslayer
Message:

for musl we can use crypt_r and so we dont need a extra lock

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/httpd/httpd.c

    r32577 r32579  
    8686#endif
    8787
     88#include <crypt.h>
     89
    8890#define SERVER_NAME "httpd"
    8991#define PROTOCOL "HTTP/1.0"
     
    163165#ifndef HAVE_MICRO
    164166
     167#ifdef __UCLIBC__
    165168pthread_mutex_t crypt_mutex;
     169#endif
    166170pthread_mutex_t httpd_mutex;
    167171pthread_mutex_t input_mutex;
     
    203207{
    204208#ifndef HAVE_MICRO
     209#ifdef __UCLIBC__
    205210        pthread_mutex_lock(&crypt_mutex);
     211#endif
    206212#endif
    207213        char *authinfo;
     
    237243        char *enc1;
    238244        char *enc2;
     245#ifdef __UCLIBC__
    239246        enc1 = crypt(authinfo, (const char *)conn_fp->auth_userid);
     247#else
     248        struct crypt_data data;
     249        enc1 = crypt_r(authinfo, (const char *)conn_fp->auth_userid, &data);
     250#endif
    240251        if (!enc1 || strcmp(enc1, conn_fp->auth_userid)) {
    241252                goto out;
    242253        }
    243254        char dummy[128];
     255#ifdef __UCLIBC__
    244256        enc2 = crypt(authpass, (const char *)conn_fp->auth_passwd);
     257#else
     258        enc2 = crypt_r(authpass, (const char *)conn_fp->auth_passwd, &data);
     259#endif
     260
    245261        if (!enc2 || strcmp(enc2, conn_fp->auth_passwd)) {
    246262                syslog(LOG_INFO, "httpd login failure - bad passwd !\n");
     
    254270        free(authinfo);
    255271#ifndef HAVE_MICRO
     272#ifdef __UCLIBC__
    256273        pthread_mutex_unlock(&crypt_mutex);
     274#endif
    257275#endif
    258276
     
    12161234#endif
    12171235#ifndef HAVE_MICRO
     1236#ifdef __UCLIBC__
    12181237        pthread_mutex_init(&crypt_mutex, NULL);
     1238#endif
    12191239        pthread_mutex_init(&httpd_mutex, NULL);
    12201240        pthread_mutex_init(&input_mutex, NULL);
Note: See TracChangeset for help on using the changeset viewer.