~posulliv/drizzle/optimizer-style-cleanup

« back to all changes in this revision

Viewing changes to plugin/auth_pam/auth_pam.cc

  • Committer: Padraig O'Sullivan
  • Date: 2010-03-15 14:05:26 UTC
  • mfrom: (1237.9.99 staging)
  • Revision ID: osullivan.padraig@gmail.com-20100315140526-opbgwdwn6tfecdkq
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
*/
24
24
 
25
25
#include "config.h"
26
 
#include <drizzled/session.h>
27
 
#include <drizzled/plugin/authentication.h>
 
26
 
28
27
#include <security/pam_appl.h>
29
28
#if !defined(__sun) && !defined(__FreeBSD__)
30
29
#include <security/pam_misc.h>
31
30
#endif
32
31
 
 
32
#include "drizzled/security_context.h"
 
33
#include "drizzled/plugin/authentication.h"
 
34
 
33
35
using namespace drizzled;
34
36
 
35
37
typedef struct {
104
106
public:
105
107
  Auth_pam(std::string name_arg)
106
108
    : drizzled::plugin::Authentication(name_arg) {}
107
 
  virtual bool authenticate(Session *session, const char *password)
 
109
  virtual bool authenticate(const SecurityContext &sctx,
 
110
                            const std::string &password)
108
111
  {
109
112
    int retval;
110
113
    auth_pam_userinfo userinfo= { NULL, NULL };
111
114
    struct pam_conv conv_info= { &auth_pam_talker, (void*)&userinfo };
112
115
    pam_handle_t *pamh= NULL;
113
116
 
114
 
    userinfo.name= session->getSecurityContext().getUser().c_str();
115
 
    userinfo.password= password;
 
117
    userinfo.name= sctx.getUser().c_str();
 
118
    userinfo.password= password.c_str();
116
119
 
117
120
    retval= pam_start("check_user", userinfo.name, &conv_info, &pamh);
118
121
 
160
163
  PLUGIN_LICENSE_GPL,
161
164
  initialize, /* Plugin Init */
162
165
  finalize, /* Plugin Deinit */
163
 
  NULL,   /* status variables */
164
166
  NULL,   /* system variables */
165
167
  NULL    /* config options */
166
168
}