PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : cgi-script und Logindatenverarbeitung



jano
20.03.08, 18:30
Hi

Ich würde gerne die http/htaccess login daten in einem cgi-script benutzen.

Meine htaccess-Auth läuft über eine mysql Datenbank, dank mod_dbd, mod_authn_dbd.

Laut den docs von apache.org werden bei der mysql Abfrage die Logindaten als "environment variables" gespeichert.



http://httpd.apache.org/docs/2.2/mod/mod_authn_dbd.html
Whenever a query is made to the database server, all columns returned by the query are placed in the environment, using environment variables with the prefix "AUTHENTICATE_".

If a database query for example returned the username, full name and telephone number of a user, a CGI program will have access to this information without the need to make a second independent database query to gather this additional information.

This has the potential to dramatically simplify the coding and configuration required in some web applications.


also logge ich mich ein und greife auf das cgi-script zu

print $ENV{'AUTHENTICATE_user_name'} //user_name, so heißt die user-Spalte in der Datenbank
im cgi-script liefert keine Ausgabe.

AUTHENTICATE wird auch nicht in meinem Script aufgeführt, welches alle Variablen ausgibt.

Ich hab Apache 2.2.8

Gruß

Jan

marce
20.03.08, 21:32
Ohne es im Moment gerade hier konkret nachstellen zu können - liegt das CGI-Script unterhalb des VZ, für das die Auth. geschaltet wurde?

jano
21.03.08, 17:05
ok.. also wenn das script unsicher im Webverzeichnis liegt, welches auth geschützt ist, bekomme ich zwar keine AUTHENTICATE_ Variable aber immerhin eine REMOTE_USER Variable, dies auch tut.

Jetzt bleibt nur noch die Frage, wie ich die in Shellscripten abfrage.
Also in perl gehts ja mit:

print $ENV{'REMOTE_USER'};

Gruß

Jan

jano
21.03.08, 18:13
hat sich erledigt..danke