diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2024-01-07 23:03:23 +0000 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2024-01-07 23:49:31 +0000 |
commit | cd6eca00f4da52b54382d31cf28dd92eca98c576 (patch) | |
tree | 929b67e968a4ee6645aa138f7191f87aeef987e4 /src/LYMain.c | |
parent | c244c640f9b4f69f521d286b77db0be566a5a610 (diff) | |
download | lynx-snapshots-cd6eca00f4da52b54382d31cf28dd92eca98c576.tar.gz |
snapshot of project "lynx", label v2-9-0dev_12n
Diffstat (limited to 'src/LYMain.c')
-rw-r--r-- | src/LYMain.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/LYMain.c b/src/LYMain.c index f7b848e4..ab48caea 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYMain.c,v 1.299 2023/10/23 08:05:32 tom Exp $ + * $LynxId: LYMain.c,v 1.300 2024/01/07 15:31:25 tom Exp $ */ #include <HTUtils.h> #include <HTTP.h> @@ -69,6 +69,13 @@ #include <LYexit.h> #include <LYLeaks.h> +#if defined(HAVE_PWD_H) && defined(HAVE_GETPWUID) && !defined(DONT_HAVE_PW_GECOS) +#define USE_GETPWUID 1 +#include <pwd.h> +#else +#define USE_GETPWUID 0 +#endif + /* ahhhhhhhhhh!! Global variables :-< */ #ifdef SOCKS BOOLEAN socks_flag = TRUE; @@ -1041,6 +1048,10 @@ int main(int argc, char filename[LY_MAXPATH]; BOOL LYGetStdinArgs = FALSE; +#if USE_GETPWUID + struct passwd *my_pwd; +#endif + #ifdef _WINDOWS WSADATA WSAData; #endif /* _WINDOWS */ @@ -1450,13 +1461,14 @@ int main(int argc, #if defined (VMS) || defined (NOUSERS) !strcasecomp((LYGetEnv("USER") == NULL ? " " : LYGetEnv("USER")), ANONYMOUS_USER) -#else -#ifdef HAVE_CUSERID - STREQ((char *) cuserid((char *) NULL), ANONYMOUS_USER) +#elif USE_GETPWUID + ((my_pwd = getpwuid(getuid())) == NULL + || STREQ(my_pwd->pw_gecos, ANONYMOUS_USER)) +#elif defined(HAVE_CUSERID) + STREQ((char *) cuserid(NULL), ANONYMOUS_USER) #else STREQ(((char *) getlogin() == NULL ? " " : getlogin()), ANONYMOUS_USER) -#endif /* HAVE_CUSERID */ -#endif /* VMS */ +#endif /* checks for user-id */ ) { parse_restrictions("default"); LYRestricted = TRUE; |