plugin_auth.h.pp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #include <mysql/plugin.h>
  2. typedef void * MYSQL_PLUGIN;
  3. struct st_mysql_xid {
  4. long formatID;
  5. long gtrid_length;
  6. long bqual_length;
  7. char data[128];
  8. };
  9. typedef struct st_mysql_xid MYSQL_XID;
  10. enum enum_mysql_show_type
  11. {
  12. SHOW_UNDEF, SHOW_BOOL,
  13. SHOW_INT,
  14. SHOW_LONG,
  15. SHOW_LONGLONG,
  16. SHOW_CHAR, SHOW_CHAR_PTR,
  17. SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE
  18. };
  19. enum enum_mysql_show_scope
  20. {
  21. SHOW_SCOPE_UNDEF,
  22. SHOW_SCOPE_GLOBAL
  23. };
  24. struct st_mysql_show_var
  25. {
  26. const char *name;
  27. char *value;
  28. enum enum_mysql_show_type type;
  29. enum enum_mysql_show_scope scope;
  30. };
  31. typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *);
  32. struct st_mysql_sys_var;
  33. struct st_mysql_value;
  34. typedef int (*mysql_var_check_func)(void* thd,
  35. struct st_mysql_sys_var *var,
  36. void *save, struct st_mysql_value *value);
  37. typedef void (*mysql_var_update_func)(void* thd,
  38. struct st_mysql_sys_var *var,
  39. void *var_ptr, const void *save);
  40. struct st_mysql_plugin
  41. {
  42. int type;
  43. void *info;
  44. const char *name;
  45. const char *author;
  46. const char *descr;
  47. int license;
  48. int (*init)(MYSQL_PLUGIN);
  49. int (*deinit)(MYSQL_PLUGIN);
  50. unsigned int version;
  51. struct st_mysql_show_var *status_vars;
  52. struct st_mysql_sys_var **system_vars;
  53. void * __reserved1;
  54. unsigned long flags;
  55. };
  56. struct st_mysql_daemon
  57. {
  58. int interface_version;
  59. };
  60. struct st_mysql_information_schema
  61. {
  62. int interface_version;
  63. };
  64. struct st_mysql_storage_engine
  65. {
  66. int interface_version;
  67. };
  68. struct handlerton;
  69. struct Mysql_replication {
  70. int interface_version;
  71. };
  72. struct st_mysql_value
  73. {
  74. int (*value_type)(struct st_mysql_value *);
  75. const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
  76. int (*val_real)(struct st_mysql_value *, double *realbuf);
  77. int (*val_int)(struct st_mysql_value *, long long *intbuf);
  78. int (*is_unsigned)(struct st_mysql_value *);
  79. };
  80. int thd_in_lock_tables(const void* thd);
  81. int thd_tablespace_op(const void* thd);
  82. long long thd_test_options(const void* thd, long long test_options);
  83. int thd_sql_command(const void* thd);
  84. const char *set_thd_proc_info(void* thd, const char *info,
  85. const char *calling_func,
  86. const char *calling_file,
  87. const unsigned int calling_line);
  88. void **thd_ha_data(const void* thd, const struct handlerton *hton);
  89. void thd_storage_lock_wait(void* thd, long long value);
  90. int thd_tx_isolation(const void* thd);
  91. int thd_tx_is_read_only(const void* thd);
  92. void* thd_tx_arbitrate(void* requestor, void* holder);
  93. int thd_tx_priority(const void* thd);
  94. int thd_tx_is_dd_trx(const void* thd);
  95. char *thd_security_context(void* thd, char *buffer, size_t length,
  96. size_t max_query_len);
  97. void thd_inc_row_count(void* thd);
  98. int thd_allow_batch(void* thd);
  99. void thd_mark_transaction_to_rollback(void* thd, int all);
  100. int mysql_tmpfile(const char *prefix);
  101. int thd_killed(const void* thd);
  102. void thd_set_kill_status(const void* thd);
  103. void thd_binlog_pos(const void* thd,
  104. const char **file_var,
  105. unsigned long long *pos_var);
  106. unsigned long thd_get_thread_id(const void* thd);
  107. void thd_get_xid(const void* thd, MYSQL_XID *xid);
  108. void mysql_query_cache_invalidate4(void* thd,
  109. const char *key, unsigned int key_length,
  110. int using_trx);
  111. void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
  112. void thd_set_ha_data(void* thd, const struct handlerton *hton,
  113. const void *ha_data);
  114. #include "plugin_auth_common.h"
  115. typedef struct st_plugin_vio_info
  116. {
  117. enum { MYSQL_VIO_INVALID, MYSQL_VIO_TCP, MYSQL_VIO_SOCKET,
  118. MYSQL_VIO_PIPE, MYSQL_VIO_MEMORY } protocol;
  119. int socket;
  120. } MYSQL_PLUGIN_VIO_INFO;
  121. typedef struct st_plugin_vio
  122. {
  123. int (*read_packet)(struct st_plugin_vio *vio,
  124. unsigned char **buf);
  125. int (*write_packet)(struct st_plugin_vio *vio,
  126. const unsigned char *packet,
  127. int packet_len);
  128. void (*info)(struct st_plugin_vio *vio, struct st_plugin_vio_info *info);
  129. } MYSQL_PLUGIN_VIO;
  130. typedef struct st_mysql_server_auth_info
  131. {
  132. char *user_name;
  133. unsigned int user_name_length;
  134. const char *auth_string;
  135. unsigned long auth_string_length;
  136. char authenticated_as[96 +1];
  137. char external_user[512];
  138. int password_used;
  139. const char *host_or_ip;
  140. unsigned int host_or_ip_length;
  141. } MYSQL_SERVER_AUTH_INFO;
  142. struct st_mysql_auth
  143. {
  144. int interface_version;
  145. const char *client_auth_plugin;
  146. int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info);
  147. int (*generate_authentication_string)(char *outbuf,
  148. unsigned int *outbuflen, const char *inbuf, unsigned int inbuflen);
  149. int (*validate_authentication_string)(char* const inbuf, unsigned int buflen);
  150. int (*set_salt)(const char *password, unsigned int password_len,
  151. unsigned char* salt, unsigned char *salt_len);
  152. const unsigned long authentication_flags;
  153. };