On Wed, 16 Dec 2009 17:23:06 +1300, Andrew McMillan wrote:

> > Sorry for the missing patch & cheers,
> No problem.

Thanks for the quick reply!
 
> I was considering something like this:
> 
> diff --git a/inc/drivers_squid_pam.php b/inc/drivers_squid_pam.php
> index a4a0de7..d2cd862 100644
> --- a/inc/drivers_squid_pam.php
> +++ b/inc/drivers_squid_pam.php
> @@ -67,7 +67,8 @@ function SQUID_PAM_check($username, $password ){
>      }
>      else {
>        dbg_error_log( "PAM", "user %s doesn't exist in local DB, we need to 
> create it",$usernam
> -      $fullname = trim( exec("getent passwd | grep ^" . $username ." | cut 
> -d \":\" -f5"), ' ,
> +      $fullname = exec('getent passwd "'.$username.'"' );
> +      $fullname = preg_replace( '{^[^:]+:[^:]+:\d+:\d+:([^:,]+)(,[^:]*):}', 
> '$1', $fullname );
>        $usr = (object) array(
>                'user_no' => 0,
>                'username' => $username,
> 
> 
> Can you test for me if that works for you?  


Not really. Besides the minor glitch that two lines are cut off at
the right edge -- if I fix it I end up with:

You are logged on as gregoa (gregor herrmann/home/gregoa:/bin/bash)

Let's try ...

*a bit later*

Something like the following works:

--- inc/drivers_squid_pam.php.orig      2009-12-16 16:44:25.000000000 +0100
+++ inc/drivers_squid_pam.php   2009-12-16 16:59:27.000000000 +0100
@@ -67,7 +67,8 @@
     }
     else {
       dbg_error_log( "PAM", "user %s doesn't exist in local DB, we need to 
create it",$username );
-      $fullname = trim( exec("getent passwd | grep ^" . $username ." | cut -d 
\":\" -f5"), ' ,' );
+      $fullname = exec('getent passwd "'.$username.'"' );
+      $fullname = preg_replace( '{^[^:]+:[^:]+:\d+:\d+:([^:,]+)(,[^:]*):.+$}', 
'$1', $fullname );
       $usr = (object) array(
               'user_no' => 0,
               'username' => $username,


Cheers,
gregor

-- 
 .''`.   http://info.comodo.priv.at/ -- GPG Key IDs: 0x00F3CFE4, 0x8649AA06
 : :' :  Debian GNU/Linux user, admin, & developer - http://www.debian.org/
 `. `'   Member of VIBE!AT, SPI Inc., fellow of FSFE | http://got.to/quote/
   `-    NP: Sting: We Work The Black Seam

Attachment: signature.asc
Description: Digital signature

Reply via email to