From b64c02908021993b6a6b249b4066ddce0741dc25 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sun, 25 Jun 2023 19:47:32 +0800 Subject: [PATCH] libc/pwd: Correct the geos related comment and ddd ROOT_GEOS macro fix the minor issue in https://github.com/apache/nuttx/pull/7998 Signed-off-by: Xiang Xiao --- libs/libc/pwd/lib_find_pwdfile.c | 3 ++- libs/libc/pwd/lib_getpwnam.c | 2 +- libs/libc/pwd/lib_getpwnamr.c | 2 +- libs/libc/pwd/lib_getpwuid.c | 2 +- libs/libc/pwd/lib_getpwuidr.c | 2 +- libs/libc/pwd/lib_pwd.h | 5 +++++ 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libs/libc/pwd/lib_find_pwdfile.c b/libs/libc/pwd/lib_find_pwdfile.c index d2020b7748..a7781631be 100644 --- a/libs/libc/pwd/lib_find_pwdfile.c +++ b/libs/libc/pwd/lib_find_pwdfile.c @@ -133,13 +133,14 @@ static int pwd_foreach(pwd_foreach_match_t match, uintptr_t arg, * * The format of the password file is: * - * user:x:uid:uid:home + * user:x:uid:uid:geos:home * * Where: * user: User name * x: Encrypted password * uid: User ID * uid: Group ID + * geos: User information * home: Login directory */ diff --git a/libs/libc/pwd/lib_getpwnam.c b/libs/libc/pwd/lib_getpwnam.c index 61c1b14fd5..8cda336a6a 100644 --- a/libs/libc/pwd/lib_getpwnam.c +++ b/libs/libc/pwd/lib_getpwnam.c @@ -71,7 +71,7 @@ FAR struct passwd *getpwnam(FAR const char *name) return NULL; } - return getpwbuf(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_NAME, ROOT_DIR, + return getpwbuf(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_GEOCS, ROOT_DIR, ROOT_SHELL); #endif } diff --git a/libs/libc/pwd/lib_getpwnamr.c b/libs/libc/pwd/lib_getpwnamr.c index 557cf45d3f..eba4798e56 100644 --- a/libs/libc/pwd/lib_getpwnamr.c +++ b/libs/libc/pwd/lib_getpwnamr.c @@ -82,7 +82,7 @@ int getpwnam_r(FAR const char *name, FAR struct passwd *pwd, FAR char *buf, return 0; } - return getpwbuf_r(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_NAME, ROOT_DIR, + return getpwbuf_r(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_GEOCS, ROOT_DIR, ROOT_SHELL, pwd, buf, buflen, result); #endif } diff --git a/libs/libc/pwd/lib_getpwuid.c b/libs/libc/pwd/lib_getpwuid.c index f9606d9fa6..582672990a 100644 --- a/libs/libc/pwd/lib_getpwuid.c +++ b/libs/libc/pwd/lib_getpwuid.c @@ -70,7 +70,7 @@ FAR struct passwd *getpwuid(uid_t uid) return NULL; } - return getpwbuf(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_NAME, ROOT_DIR, + return getpwbuf(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_GEOCS, ROOT_DIR, ROOT_SHELL); #endif } diff --git a/libs/libc/pwd/lib_getpwuidr.c b/libs/libc/pwd/lib_getpwuidr.c index 593c50b552..7b477cdee2 100644 --- a/libs/libc/pwd/lib_getpwuidr.c +++ b/libs/libc/pwd/lib_getpwuidr.c @@ -81,7 +81,7 @@ int getpwuid_r(uid_t uid, FAR struct passwd *pwd, FAR char *buf, return 0; } - return getpwbuf_r(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_NAME, ROOT_DIR, + return getpwbuf_r(ROOT_UID, ROOT_GID, ROOT_NAME, ROOT_GEOCS, ROOT_DIR, ROOT_SHELL, pwd, buf, buflen, result); #endif } diff --git a/libs/libc/pwd/lib_pwd.h b/libs/libc/pwd/lib_pwd.h index 7a6a0b843c..582616c3ee 100644 --- a/libs/libc/pwd/lib_pwd.h +++ b/libs/libc/pwd/lib_pwd.h @@ -33,9 +33,14 @@ * Pre-processor Definitions ****************************************************************************/ +#ifndef CONFIG_LIBC_PASSWD_LINESIZE +# define CONFIG_LIBC_PASSWD_LINESIZE 80 +#endif + #define ROOT_NAME "root" #define ROOT_UID 0 #define ROOT_GID 0 +#define ROOT_GEOCS "root" #define ROOT_DIR "/root" #define ROOT_SHELL "/bin/nsh"