OpenHarmony开发者论坛

标题: OpenHarmony里有没有shadow文件,支持通过getspnam函数,从/etc/shadow 文件中读取用户的加密密码信息吗 [打印本页]

作者: 111p    时间: 2025-3-17 10:18
标题: OpenHarmony里有没有shadow文件,支持通过getspnam函数,从/etc/shadow 文件中读取用户的加密密码信息吗
[md]### 【问题描述】

1. 我现在在编译三方库openssh,但是在make阶段报错,显示找不到getspnam函数,然后我去shadow.h和libcrypt.a里面找了,都没有找到gestpnam函数的实现,所以我想问一下OpenHarmony支持通过getspnam函数,从/etc/shadow 文件中读取用户的加密密码信息吗,假如不支持的话,就可以把shadow给禁用了
2. 运行的指令
   ./configure --host=aarch64-linux CC=/home/wbk/opt/native/llvm/bin/aarch64-unknown-linux-ohos-clang CXX=/home/wbk/opt/native/llvm/bin/aarch64-unknown-linux-ohos-clang++ --prefix=/home/wbk/opt/output/openssh\_v8 --with-ssl-dir=/home/wbk/opt/output/openssl\_v8 --with-zlib=/home/wbk/opt//output/zlib\_v8 CFLAGS="--sysroot=/home/wbk/opt/native/sysroot" LDFLAGS="-L/home/wbk/opt/native/sysroot/usr/lib -lcrypt"
3. 报错显示

   /home/wbk/opt/native/llvm/bin/aarch64-unknown-linux-ohos-clang --sysroot=/home/wbk/opt/native/sysroot -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wmisleading-indentation -Wbitwise-instead-of-logical -fno-strict-aliasing -mretpoline -D_FORTIFY_SOURCE=2 -ftrapv -fzero-call-used-regs=all -fno-builtin-memset -fstack-protector-strong   -fPIC -I. -I.. -I. -I./.. -I/home/wbk/opt/output/openssl_v8/include -I/home/wbk/opt//output/zlib_v8/include  -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_GNU_SOURCE -DHAVE_CONFIG_H -c xcrypt.c
   xcrypt.c:134:21: warning: call to undeclared function 'getspnam'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   struct spwd *spw = getspnam(pw->pw_name);
   ^
   xcrypt.c:134:15: error: incompatible integer to pointer conversion initializing 'struct spwd *' with an expression of type 'int' [-Wint-conversion]
   struct spwd *spw = getspnam(pw->pw_name);
   ^     ~~~~~~~~~~~~~~~~~~~~~
   1 warning and 1 error generated.
   make[1]: *** [Makefile:106: xcrypt.o] Error 1
   make[1]: Leaving directory '/home/wbk/opt/openssh-9.5p1/openbsd-compat'
   make: *** [Makefile:199: openbsd-compat/libopenbsd-compat.a] Error 2

   ![image.png](https://forums-obs.openharmony.c ... vtzx609nhwbwa02.png "image.png")

### 【运行环境】

交叉编译工具链版本:5.0.0
openssh版本:9.5
[/md]




欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/) Powered by Discuz! X3.5