1 |
/* Hurdish login |
/* Hurdish login |
2 |
|
|
3 |
Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. |
Copyright (C) 1995,96,97,98,99,2002 Free Software Foundation, Inc. |
4 |
|
|
5 |
Written by Miles Bader <miles@gnu.ai.mit.edu> |
Written by Miles Bader <miles@gnu.org> |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License as |
modify it under the terms of the GNU General Public License as |
210 |
/* Lookup the host HOST, and add entries for VIA (the host name), and |
/* Lookup the host HOST, and add entries for VIA (the host name), and |
211 |
VIA_ADDR (the dotted decimal address) to ARGS & ARGS_LEN. */ |
VIA_ADDR (the dotted decimal address) to ARGS & ARGS_LEN. */ |
212 |
static error_t |
static error_t |
213 |
add_canonical_host (char **args, unsigned *args_len, char *host) |
add_canonical_host (char **args, size_t *args_len, char *host) |
214 |
{ |
{ |
215 |
struct hostent *he = gethostbyname (host); |
struct hostent *he = gethostbyname (host); |
216 |
|
|
247 |
/* Add the `=' separated environment entry ENTRY to ENV & ENV_LEN, exiting |
/* Add the `=' separated environment entry ENTRY to ENV & ENV_LEN, exiting |
248 |
with an error message if we can't. */ |
with an error message if we can't. */ |
249 |
static void |
static void |
250 |
add_entry (char **env, unsigned *env_len, char *entry) |
add_entry (char **env, size_t *env_len, char *entry) |
251 |
{ |
{ |
252 |
char *name = strsep (&entry, "="); |
char *name = strsep (&entry, "="); |
253 |
error_t err = envz_add (env, env_len, name, entry); |
error_t err = envz_add (env, env_len, name, entry); |
377 |
char *path; |
char *path; |
378 |
error_t err = 0; |
error_t err = 0; |
379 |
char *args = 0; /* The login parameters */ |
char *args = 0; /* The login parameters */ |
380 |
unsigned args_len = 0; |
size_t args_len = 0; |
381 |
char *args_defs = 0; /* Defaults for login parameters. */ |
char *args_defs = 0; /* Defaults for login parameters. */ |
382 |
unsigned args_defs_len = 0; |
size_t args_defs_len = 0; |
383 |
char *env = 0; /* The new environment. */ |
char *env = 0; /* The new environment. */ |
384 |
unsigned env_len = 0; |
size_t env_len = 0; |
385 |
char *env_defs = 0; /* Defaults for the environment. */ |
char *env_defs = 0; /* Defaults for the environment. */ |
386 |
unsigned env_defs_len = 0; |
size_t env_defs_len = 0; |
387 |
char *parent_env = 0; /* The environment we got from our parent */ |
char *parent_env = 0; /* The environment we got from our parent */ |
388 |
unsigned parent_env_len = 0; |
size_t parent_env_len = 0; |
389 |
int no_environ = 0; /* If false, use the env as default params. */ |
int no_environ = 0; /* If false, use the env as default params. */ |
390 |
int no_args = 0; /* If false, put login params in the env. */ |
int no_args = 0; /* If false, put login params in the env. */ |
391 |
int inherit_environ = 0; /* True if we shouldn't clear our env. */ |
int inherit_environ = 0; /* True if we shouldn't clear our env. */ |
394 |
int paranoid = 0; /* Admit no knowledge. */ |
int paranoid = 0; /* Admit no knowledge. */ |
395 |
int retry = 0; /* For some failures, exec a login shell. */ |
int retry = 0; /* For some failures, exec a login shell. */ |
396 |
char *retry_args = 0; /* Args passed when retrying. */ |
char *retry_args = 0; /* Args passed when retrying. */ |
397 |
unsigned retry_args_len = 0; |
size_t retry_args_len = 0; |
398 |
char *shell = 0; /* The shell program to run. */ |
char *shell = 0; /* The shell program to run. */ |
399 |
char *sh_arg0 = 0; /* The shell's argv[0]. */ |
char *sh_arg0 = 0; /* The shell's argv[0]. */ |
400 |
char *sh_args = 0; /* The args to the shell. */ |
char *sh_args = 0; /* The args to the shell. */ |
401 |
unsigned sh_args_len = 0; |
size_t sh_args_len = 0; |
402 |
int shell_arg = 0; /* If there are shell args, use the first as |
int shell_arg = 0; /* If there are shell args, use the first as |
403 |
the shell name. */ |
the shell name. */ |
404 |
struct ugids ugids = UGIDS_INIT; /* Authorization of the new shell. */ |
struct ugids ugids = UGIDS_INIT; /* Authorization of the new shell. */ |
616 |
{ |
{ |
617 |
struct passwd *pw; |
struct passwd *pw; |
618 |
char *passwd = 0; /* Login parameters from /etc/passwd */ |
char *passwd = 0; /* Login parameters from /etc/passwd */ |
619 |
unsigned passwd_len = 0; |
size_t passwd_len = 0; |
620 |
|
|
621 |
/* Decide which password entry to get parameters from. */ |
/* Decide which password entry to get parameters from. */ |
622 |
if (ugids.eff_uids.num > 0) |
if (ugids.eff_uids.num > 0) |