magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 2000 > 06 > Programming with Perl  

Self-Registering Password Protection, Part 2

By Randal L. Schwartz

Last month, I introduced a mod_perl authentication and authorization module that permitted an extended format htpasswd-like file. The purposes of the extensions were to associate an email address with each user, and give a list of "keys" that the user would have in his or her permission. Then the htaccess files would refer to a series of "locks" needed for access to a particular file or directory, and access was granted only when the user had the keys for all the locks.

But the best part of the module was that we redirected any failed authentications and authorizations to a CGI program. In the case that the program recognized the unauthorized user's email address, it would allow the user to create a username and password.

It's time to present the CGI handler to conclude the picture. Before we begin, you should check the correction to last month's code.

The code for the CGI handler is shown in Listing 1. Line 1 turns on taint mode, and because I use a child process later, I set the PATH in line 4 to keep taint mode from failing.

Line 6 is a reminder that this script won't work if I move it to the /perl directory (my Apache::Registry area) because I use nested subroutines and file-scoped my variables—a deadly combo with that module.




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2