.\" Copyright (c) 1989, 1991 The Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)getpass.3 6.5 (Berkeley) 5/21/91 .\" .\" Converted for Linux, Mon Nov 29 14:41:51 1993, faith@cs.unc.edu .\" Translated into german (16.11.1996) by Andreas D. Preissig .\" Fri Jan 12 19:31:54 2001: Modified by Martin Schulze .\" .TH GETPASS 3 "29. November 1993" "BSD MANPAGE" "Bibliotheksfunktionen" .SH BEZEICHNUNG getpass \- Passwort erfragen .SH "ÜBERSICHT" .B #include .br ..B #include .sp .B "char *getpass( const char *" prompt ); .SH BESCHREIBUNG Diese Funktion ist veraltet. Benutzen Sie sie nicht. Die Funktion öffnet .I /dev/tty (das kontrollierende Terminal des Prozesses), zeigt die Zeichenkette .I prompt an, schaltet die Ausgabe ab, liest die Zeile (das "Passwort"), restauriert den Status des Terminals und schließt .I /dev/tty wieder. Das Passwort darf bis zu .B _PASSWORD_LEN (zurzeit 128) Zeichen lang sein. Alle überzähligen Zeichen und das abschließende Newline-Zeichen werden verworfen. (Dies kann unter Linux anders sein) .SH "RÜCKGABEWERT" Die Funktion .B getpass gibt einen Zeiger auf einen statischen Puffer zurück, der das (bzw. die ersten PASS_MAX Bytes des) Passwort ohne abschließendes Newline-Zeichen, jedoch mit einem terminierenden NULL-Zeichen, enthält. Dieser Puffer wird von einem nachfolgenden Aufruf überschrieben. Im Fehlerfall wird der Status des Terminals wiederhergestellt, .I errno entsprechend gesetzt und NULL zurückgegeben. .SH FEHLER Die Funktion kann fehlschlagen, falls .TP .B ENXIO Der Prozess hat kein kontrollierendes Terminal. .SH ANMERKUNGEN Bei libc4 und libc5 wird der Prompt nicht auf .I /dev/tty geschrieben, sondern auf .IR stderr . Wenn .I /dev/tty nicht geöffnet werden kann, wird das Passwort von .I stdin gelesen. Der statische Puffer hat eine Länge von 128 Bytes, so dass nur die ersten 127 Bytes des Passworts zurückgegeben werden. Während das Passwort gelesen wird, ist die Erzeugung von Signalen (SIGINT, SIGQUIT, SIGSTOP, SIGTSTOP) abgeschaltet und die entsprechenden Zeichen (normalerweise Strg-C, Strg-\e, strg-Z und Strg-V) werden als Teil des Passworts übertragen. Ab libc 5.4.19 ist ebenfalls kein Editieren der Zeile mehr möglich, so dass Backspace und ähnliche Zeichen ebenfalls als Teile des Passworts angesehen werden. Bei glibc2 wird der Prompt auf .I stderr geschrieben, falls .I /dev/tty nicht geöffnet werden kann und das Passwort wird von .I stdin gelesen. Es gibt keine Begrenzung der Länge des Passwortes. Editierung der Zeile ist nicht deaktiviert. Wie in SUSv2 beschrieben ist, muss der Wert von PASS_MAX in .I definiert sein, falls es kleiner als 8 ist, und auf jeden Fall mit .I sysconf(_SC_PASS_MAX) in Erfahrung gebracht werden kann. Allerdings verwirft POSIX.2 die Konstanten PASS_MAX und _SC_PASS_MAX sowie die Funktion .BR getpass (). Libc4 und libc5 haben niemals PASS_MAX oder _SC_PASS_MAX unterstützt. Glibc2 akzeptiert _SC_PASS_MAX und gibt BUFSIZ zurück (z.B., 8192). .SH DATEIEN .I /dev/tty .SH GESCHICHTE Eine .B getpass Funktion erschien in Version 7 AT&T UNIX. .SH BUGS Die Funktion .B getpass speichert ihr Resultat in einem internen statischen Objekt und gibt nur den Zeiger auf dieses Objekt zurück. Weitere Aufrufe von .B getpass werden dieses gleiche Objekt verändern. .PP Der aufrufende Prozess sollte das Passwort so schnell wie möglich auf Null setzen, um zu vermeiden, dass das Passwort weiter sichtbar in dem Adressraum dieses Prozesses ist. .SH "SIEHE AUCH" .BR crypt (3).