pszafer

Freeradius patch

Jan 17th, 2013
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.23 KB | None | 0 0
  1. --- freeradius_original.inc 2013-01-17 19:53:08.431356176 +0100
  2. +++ freeradius.inc  2013-01-17 19:38:11.151353016 +0100
  3. @@ -2747,9 +2747,34 @@
  4.     conf_mount_ro();
  5.  
  6.  }
  7. +#Function checks if Samba package is installed
  8. +function samba_isinstalled($conf){
  9. +   if(is_array($conf)){
  10. +       $instpkgs = array();
  11. +       foreach($conf as $instpkg) {
  12. +           if (strtolower($instpkg['name']) === 'samba'){
  13. +               return 'true';
  14. +           }
  15. +       }
  16. +   }
  17. +   return 'false';
  18. +}
  19.  
  20.  function freeradius_modulesmschap_resync() {
  21.     global $config;
  22. +   #$varFREERADIUS_BASE = FREERADIUS_BASE;
  23. +   #We need add ntlm_auth path to mschap config if samba is installed
  24. +   $ntlm_auth = "# ntlm_auth = /path/to/ntlm_auth --request-nt-key --username=%{%{Stripped-User-Name}:-%{%{User-Name}:-None}} --challenge=%{%{mschap:Challenge}:-00} --nt-response=%{%{mschap:NT-Response}:-00}";
  25. +   if (samba_isinstalled($config['installedpackages']['package']) === 'true'){
  26. +       $ntlm_auth = "ntlm_auth = /usr/local/bin/ntlm_auth --request-nt-key --username=%{%{Stripped-User-Name}:-%{%{User-Name}:-None}} --challenge=%{%{mschap:Challenge}:-00} --nt-response=%{%{mschap:NT-Response}:-00}";
  27. +       #we will see if samba will be installed only in /usr/local/bin or in /usr/pbi...
  28. +       #if ($varFREERADIUS_BASE  === '/usr/local'){
  29. +       #   $ntlm_auth = "ntlm_auth = /usr/local/bin/ntlm_auth --request-nt-key --username=%{%{Stripped-User-Name}:-%{%{User-Name}:-None}} --challenge=%{%{mschap:Challenge}:-00} --nt-response=%{%{mschap:NT-Response}:-00}";
  30. +       #}
  31. +       #else {
  32. +           #$ntlm_auth = "ntlm_auth = /usr/local/bin/ntlm_auth --request-nt-key --username=%{%{Stripped-User-Name}:-%{%{User-Name}:-None}} --challenge=%{%{mschap:Challenge}:-00} --nt-response=%{%{mschap:NT-Response}:-00}";
  33. +          
  34. +   }
  35.     $conf = '';
  36.  
  37.     $conf .= <<<EOD
  38. @@ -2817,8 +2842,7 @@
  39.          # attribute, and do prefix/suffix checks in order to obtain
  40.         # the "best" user name for the request.
  41.         #
  42. -#       ntlm_auth = "/path/to/ntlm_auth --request-nt-key --username=%{%{Stripped-User-Name}:-%{%{User-Name}:-None}} --challenge=%{%{mschap:Challenge}:-00} --
  43. -nt-response=%{%{mschap:NT-Response}:-00}"
  44. +        $ntlm_auth
  45.  
  46.         # For Apple Server, when running on the same machine as
  47.         # Open Directory.  It has no effect on other systems.
Add Comment
Please, Sign In to add comment