Skip to content

Commit

Permalink
LibC: Move crypt() and crypt_r() to the right header file
Browse files Browse the repository at this point in the history
According to POSIX.1 these should be in <crypt.h>.
  • Loading branch information
gunnarbeutner authored and awesomekling committed May 1, 2021
1 parent f05086a commit ce77caf
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ endif()
add_link_options(--sysroot ${CMAKE_BINARY_DIR}/Root)

include_directories(Userland/Libraries/LibC)
include_directories(Userland/Libraries/LibCrypt)
include_directories(Userland/Libraries/LibM)
include_directories(Userland/Libraries/LibPthread)
include_directories(Userland/Libraries/LibSystem)
include_directories(Userland/Services)
include_directories(Userland)
Expand Down
2 changes: 2 additions & 0 deletions Ports/openssh/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ depends="zlib openssl"
useconfigure=true
configopts="--prefix=/usr/local --disable-utmp --disable-strip --sysconfdir=/etc/ssh --with-ssl-dir=${SERENITY_INSTALL_ROOT}/usr/local/lib"

export LDFLAGS="-lcrypt -lcore"

pre_configure() {
run autoreconf
}
Expand Down
8 changes: 0 additions & 8 deletions Userland/Libraries/LibC/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,6 @@ enum {

long sysconf(int name);

struct crypt_data {
int initialized;
char result[65];
};

char* crypt(const char* key, const char* salt);
char* crypt_r(const char* key, const char* salt, struct crypt_data* data);

// If opterr is set (the default), print error messages to stderr.
extern int opterr;
// On errors, optopt is set to the erroneous *character*.
Expand Down
1 change: 1 addition & 0 deletions Userland/Libraries/LibCore/Account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <AK/ScopeGuard.h>
#include <LibCore/Account.h>
#include <LibCore/File.h>
#include <crypt.h>
#include <errno.h>
#include <grp.h>
#include <pwd.h>
Expand Down
3 changes: 2 additions & 1 deletion Userland/Libraries/LibCrypt/crypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
#include <AK/Base64.h>
#include <AK/Types.h>
#include <LibCrypto/Hash/SHA2.h>
#include <crypt.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>

extern "C" {

Expand Down
28 changes: 28 additions & 0 deletions Userland/Libraries/LibCrypt/crypt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/

/* standard symbolic constants and types
*
* values from POSIX standard unix specification
*
* https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html
*/

#pragma once

#include <sys/cdefs.h>

__BEGIN_DECLS

struct crypt_data {
int initialized;
char result[65];
};

char* crypt(const char* key, const char* salt);
char* crypt_r(const char* key, const char* salt, struct crypt_data* data);

__END_DECLS

0 comments on commit ce77caf

Please sign in to comment.