diff options
author | Ron Yorston <rmy@pobox.com> | 2016-02-22 10:00:45 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2016-02-22 10:00:45 +0000 |
commit | 371c20c008254a36e7157df6c13dc2e4cf87d6fd (patch) | |
tree | a214c03f6617dffa60df2192b312a46c93b7c19f /libbb | |
parent | ab879a41ab674129ef1593cda181cc8b64d0dadf (diff) | |
parent | 3a5cc989025eefe03fda0552b253a4a8f015a761 (diff) | |
download | busybox-w32-371c20c008254a36e7157df6c13dc2e4cf87d6fd.tar.gz busybox-w32-371c20c008254a36e7157df6c13dc2e4cf87d6fd.tar.bz2 busybox-w32-371c20c008254a36e7157df6c13dc2e4cf87d6fd.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/missing_syscalls.c | 2 | ||||
-rw-r--r-- | libbb/pw_encrypt.c | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/libbb/missing_syscalls.c b/libbb/missing_syscalls.c index e3c1e924b..093412811 100644 --- a/libbb/missing_syscalls.c +++ b/libbb/missing_syscalls.c | |||
@@ -40,8 +40,10 @@ int pivot_root(const char *new_root, const char *put_old) | |||
40 | return syscall(__NR_pivot_root, new_root, put_old); | 40 | return syscall(__NR_pivot_root, new_root, put_old); |
41 | } | 41 | } |
42 | 42 | ||
43 | # if __ANDROID_API__ < 21 | ||
43 | int tcdrain(int fd) | 44 | int tcdrain(int fd) |
44 | { | 45 | { |
45 | return ioctl(fd, TCSBRK, 1); | 46 | return ioctl(fd, TCSBRK, 1); |
46 | } | 47 | } |
48 | # endif | ||
47 | #endif | 49 | #endif |
diff --git a/libbb/pw_encrypt.c b/libbb/pw_encrypt.c index bfc7030a8..dbc15e5fc 100644 --- a/libbb/pw_encrypt.c +++ b/libbb/pw_encrypt.c | |||
@@ -52,14 +52,18 @@ char* FAST_FUNC crypt_make_pw_salt(char salt[MAX_PW_SALT_LEN], const char *algo) | |||
52 | { | 52 | { |
53 | int len = 2/2; | 53 | int len = 2/2; |
54 | char *salt_ptr = salt; | 54 | char *salt_ptr = salt; |
55 | if (algo[0] != 'd') { /* not des */ | 55 | |
56 | /* Standard chpasswd uses uppercase algos ("MD5", not "md5"). | ||
57 | * Need to be case-insensitive in the code below. | ||
58 | */ | ||
59 | if ((algo[0]|0x20) != 'd') { /* not des */ | ||
56 | len = 8/2; /* so far assuming md5 */ | 60 | len = 8/2; /* so far assuming md5 */ |
57 | *salt_ptr++ = '$'; | 61 | *salt_ptr++ = '$'; |
58 | *salt_ptr++ = '1'; | 62 | *salt_ptr++ = '1'; |
59 | *salt_ptr++ = '$'; | 63 | *salt_ptr++ = '$'; |
60 | #if !ENABLE_USE_BB_CRYPT || ENABLE_USE_BB_CRYPT_SHA | 64 | #if !ENABLE_USE_BB_CRYPT || ENABLE_USE_BB_CRYPT_SHA |
61 | if (algo[0] == 's') { /* sha */ | 65 | if ((algo[0]|0x20) == 's') { /* sha */ |
62 | salt[1] = '5' + (strcmp(algo, "sha512") == 0); | 66 | salt[1] = '5' + (strcasecmp(algo, "sha512") == 0); |
63 | len = 16/2; | 67 | len = 16/2; |
64 | } | 68 | } |
65 | #endif | 69 | #endif |