mod_userdir getpwnam override?

This is a discussion on mod_userdir getpwnam override? within the Apache Web Server forums, part of the Web Server and Related Forums category; Back in the day when I was the webmaster, I hacked the apache code to call a custom getpwnam routine ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-20-2006
dbarstis@gmail.com
 
Posts: n/a
Default mod_userdir getpwnam override?

Back in the day when I was the webmaster, I hacked the apache code to
call a custom getpwnam routine that retrieved the user's home directory
from a dbm file we generated nightly (we have over 30,000 users we
didn't want in the /etc/passwd file).

Now I find myself back in the position and want to know if there's a
module or configuration option that will allow me to override the
getpwnam function call to /etc/passwd without having to hack the code.

Any and all help would be greatly appreciated.

Thanks,
Dave

  #2 (permalink)  
Old 11-21-2006
petersprc
 
Posts: n/a
Default Re: mod_userdir getpwnam override?

Hi,

You could probably use mod_rewrite's RewriteMap directive. It can map
URLs based on a dbm file or other data sources. Some more info is here:

<http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteMap>


dbarstis@gmail.com wrote:
> Back in the day when I was the webmaster, I hacked the apache code to
> call a custom getpwnam routine that retrieved the user's home directory
> from a dbm file we generated nightly (we have over 30,000 users we
> didn't want in the /etc/passwd file).
>
> Now I find myself back in the position and want to know if there's a
> module or configuration option that will allow me to override the
> getpwnam function call to /etc/passwd without having to hack the code.
>
> Any and all help would be greatly appreciated.
>
> Thanks,
> Dave


  #3 (permalink)  
Old 11-21-2006
dbarstis@gmail.com
 
Posts: n/a
Default Re: mod_userdir getpwnam override?

Thanks for the information. Do you know where I might find a specific
example? I've found:

RewriteEngine On
RewriteMap user-dir txt:/usr/local/apache2/conf/userdir.txt
RewriteRule ^/~([^/]+)/(.*)$ ${user-dir:$1}/$2
RewriteLog /usr/local/apache2/logs/rewrite.log
RewriteLogLevel 2

/usr/local/apache2/conf/userdir.txt looks like this:
user1 /export/home/user1

Also:

RewriteMap user-dir txt:usr/local/apache2/conf/userdir.txt
RewriteEngine On
RewriteCond ${user-dir txt:$1|lookupfailed} (.*)
RewriteCond %1 !lookupfailed
RewriteRule ^/~([^/]+)/(.*)$ /%1/$2 [L]
# Trailing-Slash Redirect
RewriteCond ${user-dir txt:$1|lookupfailed} (.*)
RewriteCond %1 !lookupfailed
RewriteRule ^/~([^/]+)$ /~$1/
[L,R=301]

Anything special needed for dbm's?


petersprc wrote:
> Hi,
>
> You could probably use mod_rewrite's RewriteMap directive. It can map
> URLs based on a dbm file or other data sources. Some more info is here:
>
> <http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteMap>
>
>
> dbarstis@gmail.com wrote:
> > Back in the day when I was the webmaster, I hacked the apache code to
> > call a custom getpwnam routine that retrieved the user's home directory
> > from a dbm file we generated nightly (we have over 30,000 users we
> > didn't want in the /etc/passwd file).
> >
> > Now I find myself back in the position and want to know if there's a
> > module or configuration option that will allow me to override the
> > getpwnam function call to /etc/passwd without having to hack the code.
> >
> > Any and all help would be greatly appreciated.
> >
> > Thanks,
> > Dave


  #4 (permalink)  
Old 11-21-2006
dbarstis@gmail.com
 
Posts: n/a
Default Re: mod_userdir getpwnam override?

Yes, I know MapType needs to be dbm.

Dave

dbarstis@gmail.com wrote:
> Thanks for the information. Do you know where I might find a specific
> example? I've found:
>
> RewriteEngine On
> RewriteMap user-dir txt:/usr/local/apache2/conf/userdir.txt
> RewriteRule ^/~([^/]+)/(.*)$ ${user-dir:$1}/$2
> RewriteLog /usr/local/apache2/logs/rewrite.log
> RewriteLogLevel 2
>
> /usr/local/apache2/conf/userdir.txt looks like this:
> user1 /export/home/user1
>
> Also:
>
> RewriteMap user-dir txt:usr/local/apache2/conf/userdir.txt
> RewriteEngine On
> RewriteCond ${user-dir txt:$1|lookupfailed} (.*)
> RewriteCond %1 !lookupfailed
> RewriteRule ^/~([^/]+)/(.*)$ /%1/$2 [L]
> # Trailing-Slash Redirect
> RewriteCond ${user-dir txt:$1|lookupfailed} (.*)
> RewriteCond %1 !lookupfailed
> RewriteRule ^/~([^/]+)$ /~$1/
> [L,R=301]
>
> Anything special needed for dbm's?
>
>
> petersprc wrote:
> > Hi,
> >
> > You could probably use mod_rewrite's RewriteMap directive. It can map
> > URLs based on a dbm file or other data sources. Some more info is here:
> >
> > <http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteMap>
> >
> >
> > dbarstis@gmail.com wrote:
> > > Back in the day when I was the webmaster, I hacked the apache code to
> > > call a custom getpwnam routine that retrieved the user's home directory
> > > from a dbm file we generated nightly (we have over 30,000 users we
> > > didn't want in the /etc/passwd file).
> > >
> > > Now I find myself back in the position and want to know if there's a
> > > module or configuration option that will allow me to override the
> > > getpwnam function call to /etc/passwd without having to hack the code.
> > >
> > > Any and all help would be greatly appreciated.
> > >
> > > Thanks,
> > > Dave


  #5 (permalink)  
Old 11-21-2006
dbarstis@gmail.com
 
Posts: n/a
Default Re: mod_userdir getpwnam override?

The RewriteRule is working but the UserDir variable is ignored so I'll
have to append that to the rule.

Just an FYI for anyone else that wants to implement this.

dbarstis@gmail.com wrote:
> Yes, I know MapType needs to be dbm.
>
> Dave
>
> dbarstis@gmail.com wrote:
> > Thanks for the information. Do you know where I might find a specific
> > example? I've found:
> >
> > RewriteEngine On
> > RewriteMap user-dir txt:/usr/local/apache2/conf/userdir.txt
> > RewriteRule ^/~([^/]+)/(.*)$ ${user-dir:$1}/$2
> > RewriteLog /usr/local/apache2/logs/rewrite.log
> > RewriteLogLevel 2
> >
> > /usr/local/apache2/conf/userdir.txt looks like this:
> > user1 /export/home/user1
> >
> > Also:
> >
> > RewriteMap user-dir txt:usr/local/apache2/conf/userdir.txt
> > RewriteEngine On
> > RewriteCond ${user-dir txt:$1|lookupfailed} (.*)
> > RewriteCond %1 !lookupfailed
> > RewriteRule ^/~([^/]+)/(.*)$ /%1/$2 [L]
> > # Trailing-Slash Redirect
> > RewriteCond ${user-dir txt:$1|lookupfailed} (.*)
> > RewriteCond %1 !lookupfailed
> > RewriteRule ^/~([^/]+)$ /~$1/
> > [L,R=301]
> >
> > Anything special needed for dbm's?
> >
> >
> > petersprc wrote:
> > > Hi,
> > >
> > > You could probably use mod_rewrite's RewriteMap directive. It can map
> > > URLs based on a dbm file or other data sources. Some more info is here:
> > >
> > > <http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteMap>
> > >
> > >
> > > dbarstis@gmail.com wrote:
> > > > Back in the day when I was the webmaster, I hacked the apache code to
> > > > call a custom getpwnam routine that retrieved the user's home directory
> > > > from a dbm file we generated nightly (we have over 30,000 users we
> > > > didn't want in the /etc/passwd file).
> > > >
> > > > Now I find myself back in the position and want to know if there's a
> > > > module or configuration option that will allow me to override the
> > > > getpwnam function call to /etc/passwd without having to hack the code.
> > > >
> > > > Any and all help would be greatly appreciated.
> > > >
> > > > Thanks,
> > > > Dave


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:36 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0