Finita l'installazione configuro xorg, le consle, ecc. ecc. e creo un utente...mi loggo e sorpresa, la shell dice
Codice: Seleziona tutto
I have no name!@thermos:$Qualcuno sa cosa c'è che non va?
Moderatore: Staff

Codice: Seleziona tutto
I have no name!@thermos:$
Codice: Seleziona tutto
cat /etc/hostname
Codice: Seleziona tutto
test:x:1001:100:,,,:/home/test:/bin/bash
la shell non ha idea di cosa sia un login... /bin/login effettua il login ed e' chiamato da agetty (nel caso piu' comune) ... la shell ancora non entra in gioco! (ti sembra possibile che la shell possa aprire un file in cui e' specificato che shell usare?Paoletta ha scritto:cambia il nome utente da "test" in "guest"; "test" è il nome di un eseguibile e la shell va in tilt quando legge la riga di /etc/passwd in questione;
Codice: Seleziona tutto
void
get_current_user_info ()
{
struct passwd *entry;
/* Don't fetch this more than once. */
if (current_user.user_name == 0)
{
entry = getpwuid (current_user.uid);
if (entry)
{
current_user.user_name = savestring (entry->pw_name);
current_user.shell = (entry->pw_shell && entry->pw_shell[0])
? savestring (entry->pw_shell)
: savestring ("/bin/sh");
current_user.home_dir = savestring (entry->pw_dir);
}
else
{
current_user.user_name = _("I have no name!");
current_user.user_name = savestring (current_user.user_name);
current_user.shell = savestring ("/bin/sh");
current_user.home_dir = savestring ("/");
}
endpwent ();
}
}
Codice: Seleziona tutto
RETURN VALUE
The getpwnam() and getpwuid() functions return a pointer to a passwd structure, or NULL if the matching
entry is not found or an error occurs. If an error occurs, errno is set appropriately. If one wants to
check errno after the call, it should be set to zero before the call.


quel che voglio dire e' che la bash lo legge proprio dal suo codice sorgente... per questo e' alquanto improbabile che trovando un nome che casualmente e' uguale ad un comando "decida" di provare ad eseguirlo!Paoletta ha scritto:P.S. in effetti avevo pensato che, dopo aver effettuato il login, la bash andasse a leggere quel file (per prendere come parametro il nome dell'utente) e questo non è per nulla incompatibile con il fatto che sia /bin/login a fare il login;
difatti la bash lo legge poichè, dal codice che riporti, il contenuto della riga relativa a chi si logga è puntato da entry;

