~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/security_context.h

  • Committer: Brian Aker
  • Date: 2009-02-21 00:18:15 UTC
  • Revision ID: brian@tangent.org-20090221001815-x20e8h71e984lvs1
Completion (?) of uint conversion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef DRIZZLED_SECURITY_CONTEXT_H
22
22
#define DRIZZLED_SECURITY_CONTEXT_H
23
23
 
24
 
#include <string>
25
 
 
26
 
namespace drizzled
27
 
{
28
24
 
29
25
/**
30
 
  @class SecurityContext
 
26
  @class Security_context
31
27
  @brief A set of Session members describing the current authenticated user.
32
28
*/
33
29
 
34
 
class SecurityContext {
 
30
class Security_context {
35
31
public:
36
 
  enum PasswordType
37
 
  {
38
 
    PLAIN_TEXT,
39
 
    MYSQL_HASH
40
 
  };
41
 
 
42
 
  SecurityContext():
43
 
    password_type(PLAIN_TEXT)
44
 
  { }
45
 
 
46
 
  const std::string& getIp() const
47
 
  {
48
 
    return ip;
49
 
  }
50
 
 
51
 
  void setIp(const char *newip)
52
 
  {
53
 
    ip.assign(newip);
54
 
  }
55
 
 
56
 
  const std::string& getUser() const
57
 
  {
58
 
    return user;
59
 
  }
60
 
 
61
 
  void setUser(const std::string &newuser)
62
 
  {
63
 
    user.assign(newuser);
64
 
  }
65
 
 
66
 
  PasswordType getPasswordType(void) const
67
 
  {
68
 
    return password_type;
69
 
  }
70
 
 
71
 
  void setPasswordType(PasswordType newpassword_type)
72
 
  {
73
 
    password_type= newpassword_type;
74
 
  }
75
 
 
76
 
  const std::string& getPasswordContext() const
77
 
  {
78
 
    return password_context;
79
 
  }
80
 
 
81
 
  void setPasswordContext(const char *newpassword_context, size_t size)
82
 
  {
83
 
    password_context.assign(newpassword_context, size);
84
 
  }
85
 
 
86
 
private:
87
 
  PasswordType password_type;
 
32
  Security_context() {}
 
33
  /*
 
34
    host - host of the client
 
35
    user - user of the client, set to NULL until the user has been read from
 
36
    the connection
 
37
    priv_user - The user privilege we are using. May be "" for anonymous user.
 
38
    ip - client IP
 
39
  */
88
40
  std::string user;
89
41
  std::string ip;
90
 
  std::string password_context;
 
42
 
 
43
  void skip_grants();
 
44
  inline const char *priv_host_name()
 
45
  {
 
46
    return (ip.c_str() ? ip.c_str() : (char *)"%");
 
47
  }
91
48
};
92
49
 
93
 
} /* namespace drizzled */
94
 
 
95
50
#endif /* DRIZZLED_SECURITY_CONTEXT_H */