Advertisement
Guest User

Untitled

a guest
Aug 28th, 2011
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.63 KB | None | 0 0
  1. --- C:/Users/Bob/Desktop/radiusplugin_v2.1a_beta1/radiusplugin.cpp  Thu Sep  2 11:54:34 2010
  2. +++ C:/Users/Bob/Desktop/radiusplugin_v2.1a_beta1/radiusplugin.patched.cpp  Sun Aug 28 19:23:39 2011
  3. @@ -1092,13 +1092,17 @@
  4.   */
  5.  string getTime()
  6.  {
  7. -    time_t rawtime;
  8. -    struct tm * timeinfo;
  9. -    time ( &rawtime );
  10. -    timeinfo = localtime ( &rawtime );
  11. -    string t(ctime(&rawtime));
  12. -    t.replace(t.find("\n"),1," ");
  13. -    return t;
  14. +   time_t rawtime;
  15. +   struct tm * timeinfo;
  16. +   time ( &rawtime );
  17. +   timeinfo = localtime ( &rawtime );
  18. +   string t(ctime(&rawtime));
  19. +   size_t str_pos=t.find("\n");
  20. +   if (pos!=string::npos)
  21. +   {
  22. +     t.replace(str_pos,1," ");
  23. +   }
  24. +   return t;
  25.  }
  26.  
  27.  void get_user_env(PluginContext * context,const int type,const char * envp[], UserPlugin * user)
  28. @@ -1150,16 +1154,16 @@
  29.          user->setUsername ( get_env ( "common_name", envp ) );
  30.      if ( get_env ( "password", envp ) !=NULL )
  31.          user->setPassword ( get_env ( "password", envp ) );
  32. +    if ( get_env ( "common_name", envp ) !=NULL )
  33. +    {
  34. +        user->setCommonname ( get_env ( "common_name", envp ) );
  35. +    }
  36.      //rewrite the username if OpenVPN use the option username-as-comon-name
  37.      if ( context->conf.getUsernameAsCommonname() == true )
  38.      {
  39.          if ( DEBUG ( context->getVerbosity() ) ) cerr << getTime() << "RADIUS-PLUGIN: FOREGROUND: Commonname set to Username\n";
  40.          user->setCommonname ( get_env ( "username", envp ) );
  41.      }
  42. -    if ( get_env ( "common_name", envp ) !=NULL )
  43. -    {
  44. -        user->setCommonname ( get_env ( "common_name", envp ) );
  45. -    }
  46.  
  47.      string untrusted_ip;
  48.      // it's ipv4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement