~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/auth_pam/auth_pam.cc

  • Committer: Brian Aker
  • Date: 2008-09-04 19:31:00 UTC
  • Revision ID: brian@tangent.org-20080904193100-l849hgghfy4urj43
Changing default character set from this point on.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
3
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
2
  Sections of this where taken/modified from mod_auth_path for Apache 
5
3
*/
6
4
 
8
6
#include <drizzled/server_includes.h>
9
7
#include <drizzled/plugin_authentication.h>
10
8
#include <security/pam_appl.h>
11
 
#ifndef __sun
12
9
#include <security/pam_misc.h>
13
 
#endif
14
10
 
15
11
typedef struct {
16
12
    const char *name;
18
14
} auth_pam_userinfo;
19
15
 
20
16
static int auth_pam_talker(int num_msg,
21
 
#ifdef __sun
22
 
                           struct pam_message **msg,
23
 
#else
24
17
                           const struct pam_message **msg,
25
 
#endif
26
18
                           struct pam_response **resp,
27
19
                           void *appdata_ptr)
28
20
{
69
61
  return PAM_SUCCESS;
70
62
}
71
63
 
72
 
static bool authenticate(Session *session, const char *password)
 
64
static bool authenticate(THD *thd, const char *password)
73
65
{
74
66
  int retval;
75
67
  auth_pam_userinfo userinfo= { NULL, NULL };
76
68
  struct pam_conv conv_info= { &auth_pam_talker, (void*)&userinfo };
77
69
  pam_handle_t *pamh= NULL;
78
70
 
79
 
  userinfo.name= session->main_security_ctx.user;
 
71
  userinfo.name= thd->main_security_ctx.user;
80
72
  userinfo.password= password;
81
73
 
82
74
  retval= pam_start("check_user", userinfo.name, &conv_info, &pamh);